Bug 251760 - Account expiration date increments by one
Account expiration date increments by one
Product: Fedora
Classification: Fedora
Component: system-config-users (Show other bugs)
i386 Linux
low Severity low
: ---
: ---
Assigned To: Nils Philippsen
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2007-08-10 17:58 EDT by ray hammond
Modified: 2007-11-30 17:12 EST (History)
0 users

See Also:
Fixed In Version: 1.2.64-1.fc7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-09-17 23:20:26 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description ray hammond 2007-08-10 17:58:33 EDT
Description of problem:
Using the properties dialog it is possible to set a date of when a user's
account is due to expire, this date is not stored as date input + 1.

Version-Release number of selected component (if applicable):

How reproducible:
Every time

Steps to Reproduce:
1.As a none root user open the system-config-user utility - enter root password
when prompted.
2.Select any user from the list, in my case the user is called ray.
3.Click the properties button and select the 'Account Info' tab.
4.Check the 'Enable account expiration' checkbox.
5.Enter the date as 2008 03 29 and press OK.
6.Re-open the properties dialog and navigate to the 'Account Info' tab.

Actual results:
The date gets re-displayed as 2008 03 30.

Expected results:
The date should be re-displayed as entered. i.e. 2008 03 29

Additional info:
Every time you re-open the properties dialog and press ok the date increments by
Comment 1 Nils Philippsen 2007-08-15 04:39:18 EDT
I couldn't reproduce this on system-config-users-1.2.61. Would you please check
this with the version from updates-testing? Thanks.
Comment 2 ray hammond 2007-08-15 17:45:14 EDT
I have installed system-config-users-1.2.61 from the update-testing repo.  I did
this using the following command:

yum --enablerepo=updates-testing install system-config-users

This installed version 1.2.61-1.fc7, I followed the steps above and the date was
still incremented by one everytime I re-opened the properties dialog.  I have
recorded my actions into an avi file, accessible from:


Hope it helps.  Also could the problem be related to my timezone? I am currenlty
in Bristish Summer Time (BST)
Comment 3 Nils Philippsen 2007-08-16 04:40:56 EDT
Hmm, I can't see the video either, but that may be a problem here.

I don't think the timezone is a problem, I'm in CEST (UTC+2) now, but setting
TZ=Europe/London and running s-c-users didn't result in what you described.

- Are all other packages on the system updated?
- After setting the expiration date to 2008-03-29, what is the 8th (second to
last) field in /etc/shadow for that user?
Comment 4 ray hammond 2007-08-16 17:41:43 EDT
Sorry about the video, only works in MS Media player (whoops!).  .

I have installed FC7 again and performed a full yum update. ("yum update -y")

I now have version 1.2.60 of system-config-users. By default /etc/shadow
contains the following:


After following the steps 1 to 5 /etc/shadow contains:


After re-opening the properties dialog and pressing OK /etc/shadow contains the


After a little bit of digging I've traced my problem to:


This file is shipped with the system-config-users rpm (you certainly know that

Line 219, the ‘if’ statement, which is related to the expiration setting and its
nested statements are as follows:

if int(expire[0]) != -1:
  days = int(self.userEnt.get(libuser.SHADOWEXPIRE)[0] +1)
  tmp = days * int(secondsPerDay)
  age = time.localtime(tmp)
  year = str(age[0])
  month = str(age[1])
  day = str(age[2])

Check out the following line (extracted from above).

days = int(self.userEnt.get(libuser.SHADOWEXPIRE)[0] +1)

Why plus one?  If I put the following line in ‘print days’, after the offending
line, sure enough the debug shows that the days variable is increased by one
every time.  I then removed the plus one section of code i.e.

days = int(self.userEnt.get(libuser.SHADOWEXPIRE)[0])

The ‘days’ variable remained the same (correct value) in the /etc/shadow file
and utility.

Hope that helps a little.

Comment 5 Nils Philippsen 2007-08-16 21:30:39 EDT
Oh. That's some scary code you've dug up there. I can now reproduce the problem
and it is indeed dependent on the timezone that's set. It's kind of a rounding
error where it (hah!) sometimes subtracts 1 from the calculated number of days
when storing and sometimes not. When loading the value (which is "days since
beginning of the epoch", i.e. since 1970-01-01), it is incremented by 1,
compensating for the subtraction that happened -- or not.
Comment 6 Nils Philippsen 2007-08-16 22:31:37 EDT
system-config-users-1.2.64 keeps the expiration date stable, it should hit
updates-testing soon.
Comment 7 Fedora Update System 2007-08-17 12:12:32 EDT
system-config-users-1.2.64-1.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.
Comment 8 Fedora Update System 2007-09-17 23:20:16 EDT
system-config-users-1.2.64-1.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.