Skip to contentSkip to conversation

tzdata: We shouldn't override the localtime if it is valid

PATCH Superseded Otavio Salvador 3 participants 11 messages Feb 8, 2013

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tzdata: We shouldn't override the localtime if it is valid

The code where mistakenly replacing the localtime file setting so we end with a copy of file instead of a symbolic link. This fixes it so now, we'll only do that in case the link is pointing to invalid data.

Change-Id I16dfa5ea4f293c48bb396f4e23a2ea53e6c9e745
---
 meta/recipes-extended/tzdata/tzdata_2012d.bb |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
meta/recipes-extended/tzdata/tzdata_2012d.bb +6 -6
index 9741101..9ec6715 100644
@@ -5,7 +5,7 @@ LICENSE = "PD"
 LIC_FILES_CHKSUM = "file://asia;beginline=2;endline=3;md5=06468c0e84ef4d4c97045a4a29b08234"
 DEPENDS = "tzcode-native"
 
-PR = "r2"
+PR = "r3"
 
 inherit allarch
 
@@ -93,12 +93,12 @@ pkg_postinst_${PN} () {
 		echo "You have an invalid TIMEZONE setting in ${src}"
 		echo "Your ${etc_lt} has been reset to Universal; enjoy!"
 		tz="Universal"
+		echo "Updating ${etc_lt} with $D${datadir}/zoneinfo/${tz}"
+		if [ -L ${etc_lt} ] ; then
+			rm -f "${etc_lt}"
+		fi
+		cp -f "$D${datadir}/zoneinfo/${tz}" "${etc_lt}"
 	fi
-	echo "Updating ${etc_lt} with $D${datadir}/zoneinfo/${tz}"
-	if [ -L ${etc_lt} ] ; then
-		rm -f "${etc_lt}"
-	fi
-	cp -f "$D${datadir}/zoneinfo/${tz}" "${etc_lt}"
 }
 
 # Packages primarily organized by directory with a major city
Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 3 lines · Otavio Salvador

The code where mistakenly replacing the localtime file setting so we end with a copy of file instead of a symbolic link. This fixes it so now, we'll only do that in case the link is pointing to invalid data.

Can you fix the code to symlink instead of copy? systemd and more needs a symlink so that it can identify the name of the timezone from the link target.

Ross

#2 lore raw
Quoted 8 lines · Ross
Quoted 3 lines · Otavio Salvador

The code where mistakenly replacing the localtime file setting so we end with a copy of file instead of a symbolic link. This fixes it so now, we'll only do that in case the link is pointing to invalid data.

Can you fix the code to symlink instead of copy? systemd and more needs a symlink so that it can identify the name of the timezone from the link target.

You mean inside the if?

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
#3 lore raw
Quoted 5 lines · Otavio Salvador
Quoted 3 lines

Can you fix the code to symlink instead of copy? systemd and more needs a symlink so that it can identify the name of the timezone from the link target.

You mean inside the if?

I mean in general /etc/localtime should be a symlink and not a copy.

Ross

#4 lore raw
Quoted 8 lines · Ross
Quoted 5 lines · Otavio Salvador
Quoted 3 lines

Can you fix the code to symlink instead of copy? systemd and more needs a symlink so that it can identify the name of the timezone from the link target.

You mean inside the if?

I mean in general /etc/localtime should be a symlink and not a copy.

Ok; but I will do it in another patch ... in fact it could be simplified a lot. I will propose a patch for it.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
#5 lore raw
In reply to Burton, Ross
Quoted 8 lines · Ross
Quoted 5 lines · Otavio Salvador
Quoted 3 lines

Can you fix the code to symlink instead of copy? systemd and more needs a symlink so that it can identify the name of the timezone from the link target.

You mean inside the if?

I mean in general /etc/localtime should be a symlink and not a copy.

/etc/localtime is a real file so that /etc is not containing a link to a file in /usr; this has historically been the case unless I am not mistaken. systemd should grow up and read the contents :).

Tomas

#6 lore raw
Quoted 6 lines · Tomas Frydrych
Quoted 5 lines · Ross
Quoted 4 lines · Otavio Salvador
Quoted 3 lines

Can you fix the code to symlink instead of copy? systemd and more needs a symlink so that it can identify the name of the timezone from the link target.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

You mean inside the if?

I mean in general /etc/localtime should be a symlink and not a copy.

/etc/localtime is a real file so that /etc is not containing a link to a file in /usr; this has historically been the case unless I am not mistaken. systemd should grow up and read the contents :).

In fact a lot of software expects it to be a symlink so it shouldn't be a copy.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
#7 lore raw
Quoted 10 lines · Otavio Salvador
Quoted 8 lines · Tomas Frydrych
Quoted 7 lines · Ross
Quoted 5 lines · Otavio Salvador
Quoted 3 lines

Can you fix the code to symlink instead of copy? systemd and more needs a symlink so that it can identify the name of the timezone from the link target.

You mean inside the if?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I mean in general /etc/localtime should be a symlink and not a copy.

/etc/localtime is a real file so that /etc is not containing a link to a file in /usr; this has historically been the case unless I am not mistaken. systemd should grow up and read the contents :).

In fact a lot of software expects it to be a symlink so it shouldn't be a copy.

Lot of software does thing without understanding what it is doing, that's the nature of software. :) My point is that the code in the current recipe is not doing the unconditional copy by mistake, it is doing so intentionally so that local clock can work without /usr. Only systems that mandate the presence of /usr can use a symlink -- so this is not a bug fix but a change in an established system behaviour. If nothing else, the commit message should be clear in this regard.

Tomas

Signature · 1 line
http://sleepfive.com
#8 lore raw
Quoted 19 lines · Tomas Frydrych
Quoted 10 lines · Otavio Salvador
Quoted 8 lines · Tomas Frydrych
Quoted 7 lines · Ross
Quoted 5 lines · Otavio Salvador
Quoted 3 lines

Can you fix the code to symlink instead of copy? systemd and more needs a symlink so that it can identify the name of the timezone from the link target.

You mean inside the if?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I mean in general /etc/localtime should be a symlink and not a copy.

/etc/localtime is a real file so that /etc is not containing a link to a file in /usr; this has historically been the case unless I am not mistaken. systemd should grow up and read the contents :).

In fact a lot of software expects it to be a symlink so it shouldn't be a copy.

Quoted 7 lines

Lot of software does thing without understanding what it is doing, that's the nature of software. :) My point is that the code in the current recipe is not doing the unconditional copy by mistake, it is doing so intentionally so that local clock can work without /usr. Only systems that mandate the presence of /usr can use a symlink -- so this is not a bug fix but a change in an established system behaviour. If nothing else, the commit message should be clear in this regard.

I agree about the commit log. I'd for ignore the possibility to use /etc without /usr as the applications running at very beggning will start using GMT and move to timezone when /usr is ready. I see no problem with that.

Ross, we are at same page? If yes I will send a v3 with improved commit log.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
#9 lore raw
Quoted 6 lines · Otavio Salvador

I agree about the commit log. I'd for ignore the possibility to use /etc without /usr as the applications running at very beggning will start using GMT and move to timezone when /usr is ready. I see no problem with that.

Ross, we are at same page? If yes I will send a v3 with improved commit log.

Unless someone has a good argument against this, I agree with you.

Ross

#10 lore raw
In reply to Tomas Frydrych
Quoted 3 lines · Tomas Frydrych

/etc/localtime is a real file so that /etc is not containing a link to a file in /usr; this has historically been the case unless I am not mistaken. systemd should grow up and read the contents :).

But the contents don't identify the name of the timezone.

Ross