Re: strange date

2007-09-19 Thread Bruno

It's working fine now! Thanks a lot.

Bruno

[EMAIL PROTECTED] (Bob Proulx) writes:

 Bruno wrote:
  Ok. Everything was working perfectly until I adjusted the time in the
  KDE environment icon (it was a few minutes wrong). I did not change
  any environment variable, or file permissions. Maybe the program
  changed the permissions, but then is another type of problem (maybe
  stranger :o).
 
 Yes.  The permissions are incorrect.  I think you see the problem but
 just to be clear /etc/localtime needs to be readable by all.
 
  I was also expecting an eol in the /etc/timezone, and now I added it
  manually. 
  
  The commands you asked:
   open(/etc/localtime, O_RDONLY)= -1 EACCES (Permission denied)
   Tue, 18 Sep 2007 23:22:43 +
 
 There is the problem.  Permission denied for non-root users.  Of
 course root can open the file.  The UTC timezone + was a clue that
 this was the problem.
 
   [EMAIL PROTECTED] ~]$ ls -ld /etc/localtime
   -rw-r- 1 root root 1983 Aug 23 11:22 /etc/localtime
 
 This should be fixed.
 
   chmod a+r /etc/localtime
 
 Then non-root can read the file and get the timezone information.
 
   [EMAIL PROTECTED] ~]$ ls -ldL /etc/localtime
   -rw-r- 1 root root 1983 Aug 23 11:22 /etc/localtime
 
 On some systems /etc/localtime would have been a symlink to
 /usr/share/zoneinfo/America/Sao_Paulo and so I wanted a case with -L
 to follow through the symlink in case the /usr/share/zoneinfo files
 were the files that were not readable.
 
 I am glad that the problem is now solved.
 
 Bob
 


-- 
-
Bruno Muller Junior em 19/09/2007



___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: strange date

2007-09-18 Thread Bob Proulx
Bruno wrote:
 When I log as root, date gets the wright date and shows it to me. When
 I log as a user (any user that is not root), it shows the date plus
 three hours.
 
 The strange thing is that the system date is correct, but is shows
 wrong date to regular users and correct date to root (and only for
 root as far as I can see).

This sounds to me like one of the two have the TZ environment variable
set in the environment and the TZ variable is different from the
system default value.

  echo $TZ

Use 'env -i' to force an empty environment and remove any influence
from it.  Does this give the correct time?

  env -i date -R

Some combination of these things are probably the problem.  If the
problem is the TZ variable then this simply needs to be found where it
is being set and removed.  If the problem is the system time zone then
reconfiguring /etc/timezone for the correct timezone.  If the system
time itself is off then setting the system time may be needed.
Running NTP to keep the clock updated is recommended.

Bob


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: strange date

2007-09-18 Thread Bob Proulx
Bruno wrote:
 Did not work. I tried the commands (echo $TZ, env -i date -R) as
 regular user and then as root. Bellow, the results ( precedes all
 comands just to show the prompt lines.

When things behave differently between root and non-root and the
environment is the same then I would suspect permission issues.
Probably root can read a file that has restrictive permissions for the
non-root user.

  [EMAIL PROTECTED] ~]$ env -i date -R
  Tue, 18 Sep 2007 22:19:27 +

Note the non-root user is UTC.

  [EMAIL PROTECTED] ~]# env -i date -R
  Tue, 18 Sep 2007 19:20:01 -0300

The root user is -0300.

  [EMAIL PROTECTED] ~]# cat /etc/timezone
  America/[EMAIL PROTECTED] ~]#

I expected to see a newline on the end of that file.

Try these things.  I suspect that the non-root user is not able to
read the timezone file or perhaps the localtime file.

  LC_ALL=C strace -e trace=file date -R

Also what are the permissions on the /etc/localtime file?

  ls -ld /etc/localtime

  ls -ldL /etc/localtime

Bob


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: strange date

2007-09-18 Thread Bruno

Ok. Everything was working perfectly until I adjusted the time in the
KDE environment icon (it was a few minutes wrong). I did not change
any environment variable, or file permissions. Maybe the program
changed the permissions, but then is another type of problem (maybe
stranger :o).

I was also expecting an eol in the /etc/timezone, and now I added it
manually. 

The commands you asked:

 [EMAIL PROTECTED] ~]$ ls -ld /etc/localtime
 -rw-r- 1 root root 1983 Aug 23 11:22 /etc/localtime
 [EMAIL PROTECTED] ~]$ ls -ldL /etc/localtime
 -rw-r- 1 root root 1983 Aug 23 11:22 /etc/localtime
 [EMAIL PROTECTED] ~]$ LC_ALL=C strace -e trace=file date -R
 execve(/bin/date, [date, -R], [/* 54 vars */]) = 0
 access(/etc/ld.so.preload, R_OK)  = -1 ENOENT (No such file or
 directory)
 open(/etc/ld.so.cache, O_RDONLY)  = 3
 open(/lib/librt.so.1, O_RDONLY)   = 3
 open(/lib/libc.so.6, O_RDONLY)= 3
 open(/lib/libpthread.so.0, O_RDONLY)  = 3
 open(/etc/localtime, O_RDONLY)= -1 EACCES (Permission denied)
 open(/etc/localtime, O_RDONLY)= -1 EACCES (Permission denied)
 open(/etc/localtime, O_RDONLY)= -1 EACCES (Permission denied)
 Tue, 18 Sep 2007 23:22:43 +
 [EMAIL PROTECTED] ~]$
 [EMAIL PROTECTED] ~]$ ls -ld /etc/localtime
 -rw-r- 1 root root 1983 Aug 23 11:22 /etc/localtime
 [EMAIL PROTECTED] ~]$ ls -ldL /etc/localtime
 -rw-r- 1 root root 1983 Aug 23 11:22 /etc/localtime
 [EMAIL PROTECTED] ~]$

Bruno


[EMAIL PROTECTED] (Bob Proulx) writes:

 Bruno wrote:
  Did not work. I tried the commands (echo $TZ, env -i date -R) as
  regular user and then as root. Bellow, the results ( precedes all
  comands just to show the prompt lines.
 
 When things behave differently between root and non-root and the
 environment is the same then I would suspect permission issues.
 Probably root can read a file that has restrictive permissions for the
 non-root user.
 
   [EMAIL PROTECTED] ~]$ env -i date -R
   Tue, 18 Sep 2007 22:19:27 +
 
 Note the non-root user is UTC.
 
   [EMAIL PROTECTED] ~]# env -i date -R
   Tue, 18 Sep 2007 19:20:01 -0300
 
 The root user is -0300.
 
   [EMAIL PROTECTED] ~]# cat /etc/timezone
   America/[EMAIL PROTECTED] ~]#
 
 I expected to see a newline on the end of that file.
 
 Try these things.  I suspect that the non-root user is not able to
 read the timezone file or perhaps the localtime file.
 
   LC_ALL=C strace -e trace=file date -R
 
 Also what are the permissions on the /etc/localtime file?
 
   ls -ld /etc/localtime
 
   ls -ldL /etc/localtime
 
 Bob
 


-- 
-
Bruno Muller Junior em 18/09/2007



___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: strange date

2007-09-18 Thread Bob Proulx
Bruno wrote:
 Ok. Everything was working perfectly until I adjusted the time in the
 KDE environment icon (it was a few minutes wrong). I did not change
 any environment variable, or file permissions. Maybe the program
 changed the permissions, but then is another type of problem (maybe
 stranger :o).

Yes.  The permissions are incorrect.  I think you see the problem but
just to be clear /etc/localtime needs to be readable by all.

 I was also expecting an eol in the /etc/timezone, and now I added it
 manually. 
 
 The commands you asked:
  open(/etc/localtime, O_RDONLY)= -1 EACCES (Permission denied)
  Tue, 18 Sep 2007 23:22:43 +

There is the problem.  Permission denied for non-root users.  Of
course root can open the file.  The UTC timezone + was a clue that
this was the problem.

  [EMAIL PROTECTED] ~]$ ls -ld /etc/localtime
  -rw-r- 1 root root 1983 Aug 23 11:22 /etc/localtime

This should be fixed.

  chmod a+r /etc/localtime

Then non-root can read the file and get the timezone information.

  [EMAIL PROTECTED] ~]$ ls -ldL /etc/localtime
  -rw-r- 1 root root 1983 Aug 23 11:22 /etc/localtime

On some systems /etc/localtime would have been a symlink to
/usr/share/zoneinfo/America/Sao_Paulo and so I wanted a case with -L
to follow through the symlink in case the /usr/share/zoneinfo files
were the files that were not readable.

I am glad that the problem is now solved.

Bob


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils