Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tzdata
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GNU Libc Maintainers
tzdata
Commits
5ddb2dba
Commit
5ddb2dba
authored
2 years ago
by
Benjamin Drung
Browse files
Options
Downloads
Patches
Plain Diff
Fix exit status 10 for invalid /etc/localtime symlinks
Signed-off-by:
Benjamin Drung
<
benjamin.drung@canonical.com
>
parent
201987e5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
debian/tests/debconf
+19
-0
19 additions, 0 deletions
debian/tests/debconf
debian/tzdata.config
+18
-24
18 additions, 24 deletions
debian/tzdata.config
with
37 additions
and
24 deletions
debian/tests/debconf
+
19
−
0
View file @
5ddb2dba
...
...
@@ -79,6 +79,25 @@ class TestDebconf(unittest.TestCase):
stdout
=
subprocess
.
DEVNULL
,
)
def
test_broken_symlink
(
self
)
->
None
:
"""
Test pointing /etc/localtime to an invalid location.
"""
self
.
_set_timezone
(
pathlib
.
Path
(
"
/bin/sh
"
))
self
.
_reset_debconf
()
self
.
_call_dpkg_reconfigure
()
self
.
assertEqual
(
self
.
_get_timezone
(),
"
Etc/UTC
"
)
self
.
assertEqual
(
self
.
_get_selection
(),
"
Etc/UTC
"
)
def
test_broken_symlink_but_debconf_preseed
(
self
)
->
None
:
"""
Test broken /etc/localtime but existing debconf answers.
"""
self
.
_set_timezone
(
pathlib
.
Path
(
"
/bin/sh
"
))
self
.
_call_debconf_set_selections
(
"
tzdata tzdata/Areas select Pacific
\n
"
"
tzdata tzdata/Zones/Pacific select Yap
\n
"
)
self
.
_call_dpkg_reconfigure
()
self
.
assertEqual
(
self
.
_get_timezone
(),
"
Pacific/Yap
"
)
self
.
assertEqual
(
self
.
_get_selection
(),
"
Pacific/Yap
"
)
def
test_etc_localtime_precedes_debconf_preseed
(
self
)
->
None
:
"""
Test dpkg-reconfigure uses /etc/localtime over preseed.
"""
self
.
_set_timezone
(
"
Asia/Jerusalem
"
)
...
...
This diff is collapsed.
Click to expand it.
debian/tzdata.config
+
18
−
24
View file @
5ddb2dba
...
...
@@ -298,44 +298,38 @@ elif [ -e "$DPKG_ROOT/etc/timezone" ]; then
fi
TIMEZONE
=
"$(convert_timezone "
$
TIMEZONE
")"
if
[ -
f
"$DPKG_ROOT/usr/share/zoneinfo/$TIMEZONE"
] ;
then
AREA
=
"${TIMEZONE%%/*}"
ZONE
=
"${TIMEZONE#*/}"
fi
# The timezone is already configured
if
[ -
L
"$DPKG_ROOT/etc/localtime"
] ;
then
# Don't ask the user, except if he/she explicitely asked that
if
[ -
z
"$DEBCONF_RECONFIGURE"
] ;
then
db_fset
tzdata
/
Areas
seen
true
db_fset
"tzdata/Zones/$AREA"
seen
true
fi
# The timezone has never been configured or is falsely configured
elif
! [ -
L
"$DPKG_ROOT/etc/localtime"
] || [ -
n
"$DEBCONF_RECONFIGURE"
] ;
then
if
[ -
z
"$AREA"
] || [ -
z
"$ZONE"
] ;
then
RET
=
""
db_fget
tzdata
/
Areas
seen
||
RET
=
false
if
[
"$RET"
=
true
] ;
then
db_get
tzdata
/
Areas
AREA
=$
RET
else
AREA
=
"Etc"
fi
else
RET
=
""
db_fget
tzdata
/
Areas
seen
||
RET
=
false
if
[
"$RET"
=
true
] ;
then
db_get
tzdata
/
Areas
AREA
=$
RET
else
AREA
=
"Etc"
fi
RET
=
""
db_fget
"tzdata/Zones/$AREA"
seen
||
RET
=
false
if
[
"$RET"
=
true
] ;
then
db_get
"tzdata/Zones/$AREA"
ZONE
=$
RET
else
ZONE
=
"UTC"
fi
RET
=
""
db_fget
"tzdata/Zones/$AREA"
seen
||
RET
=
false
if
[
"$RET"
=
true
] ;
then
db_get
"tzdata/Zones/$AREA"
ZONE
=$
RET
else
ZONE
=
"UTC"
fi
db_fset
tzdata
/
Areas
seen
false
db_fset
"tzdata/Zones/$AREA"
seen
false
# The user want to handle the timezone by him/herself
else
exit
0
fi
# Initializes debconf default values from the ones found in
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment