Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#5896 closed defect (fixed)

Allow NIS-format /etc/timezone

Reported by: dhighley@… Owned by: sphery
Priority: minor Milestone: 0.22
Component: mythtv Version: head
Severity: medium Keywords: timezone modify header
Cc: Ticket locked: no

Description

Running svn head 19027. All web pages are working but displaying the following errors. User Notice at /var/www/html/mythweb/includes/mythbackend.php, line 176: Failed to set php timezone to US/Pacific highley-recommened.com

Warning at /var/www/html/mythweb/includes/utils.php, line 163: Cannot modify header information - headers already sent by (output started at /var/www/html/mythweb/includes/errors.php:143)

Attachments (1)

mythtv-5896-allow_NIS_format_etc_timezone.patch (2.0 KB) - added by sphery <mtdean@…> 15 years ago.
Allows the use of NIS-format /etc/timezone (in addition to Debian-format /etc/timezone)

Download all attachments as: .zip

Change History (13)

comment:1 Changed 15 years ago by Rob Smith

Status: newinfoneeded_new

Please run the script found at http://svn.mythtv.org/trac/attachment/ticket/5319/myth_timezone.pl and post the output.

comment:2 Changed 15 years ago by dhighley@…

I'm running frontend and backend on Fedora 8. Results of script: Net::UPnP::ControlPoint? is not installed! Current Timezone Information

id: US/Pacific highley-recommened.com

offset: -28800

time: 2008-11-09T13:35:03

Changed 15 years ago by sphery <mtdean@…>

Allows the use of NIS-format /etc/timezone (in addition to Debian-format /etc/timezone)

comment:3 Changed 15 years ago by sphery <mtdean@…>

The patch mythtv-5896-allow_NIS_format_etc_timezone.patch adds a new function parse_zone_id_config_string() that parses the value read from /etc/timezone or /etc/sysconfig/clock to ensure the value used is a valid time zone ID in the zoneinfo database. This allows us to identify the time zone for users with NIS-format /etc/timezone files, which use the format:

[zone id] [host or NIS domain name] # optional comments

as opposed to the Debian-format /etc/timezone which contains only the zone ID.

Since whitespace may exist in the zone ID and the only delimiter between the zone ID and the NIS host/domain name is whitespace, parse_zone_id_config_string() just checks for a file in the zoneinfo DB whose name corresponds to the parsed value. If not found, it removes one word from the right of the string and tries again until it either finds a file or runs out of string.

The patch also modifies the regexp used in read_time_zone_id() to allow a hash/pound character in the line to begin a comment and ensures the comment is ignored. Also, whereas read_time_zone_id() used to blindly accept the value it read as a time zone ID, the new conditional (in the 3rd hunk) requires that the value correspond to a valid zone ID in the database, otherwise, we continue searching for the time zone ID.

comment:4 Changed 15 years ago by dhighley@…

Applied patch and confirm that it does fix the issue. Thanks

comment:5 Changed 15 years ago by Rob Smith

Component: mythwebmythtv
Owner: changed from xris to Isaac Richards
Status: infoneeded_newnew

comment:6 Changed 15 years ago by Rob Smith

Summary: More PHP web page display errorsAllow NIS-format /etc/timezone

comment:7 Changed 15 years ago by stuartm

Milestone: unknown0.22
Owner: changed from Isaac Richards to stuartm
Status: newaccepted

comment:8 Changed 15 years ago by otto at kolsi dot fi

I have similar problem with freshly installed trunk on Fedora 10. In the machine /etc/sysconfig/clock contains:

# The ZONE parameter is only evaluated by system-config-date.
# The time zone of the system is defined by the contents of /etc/localtime.
ZONE="Europe/Helsinki"

Error in MythWeb is:

Failed to set php timezone to U

Running the Perl script gives:

$ ./myth_timezone.pl 
Use of uninitialized value $name in concatenation (.) or string at ./myth_timezone.pl line 44.
Current Timezone
  offset: UNKNOWN_COMMAND
    name: 

Tried to apply Sphery's attached patch but it doesn't seem to fix the issue for me.

comment:9 Changed 15 years ago by Rob Smith

(In [19553]) Re #5896, add in some extra debugging for the attempted timezone connection, and remove the cached value on an timezone set error

comment:10 Changed 15 years ago by stuartm

Owner: stuartm deleted
Status: acceptednew

comment:11 Changed 15 years ago by sphery

Resolution: fixed
Status: newclosed

(In [21338]) Allow NIS-format /etc/timezone in addition to Debian-format /etc/timezone

Fixes parsing of time zone ID when the system contains a NIS-format /etc/timezone, which contains extra information after the zone ID (hostname and possibly comments).

Closes #5896

comment:12 Changed 15 years ago by Janne Grunau

Owner: set to sphery
Note: See TracTickets for help on using tickets.