Public bug reported:

System: Ubuntu MATE 18.04.4
Package version: 1.20.2-4ubuntu1

This issue is only present when the "informal" date format is set. This
format is the last entry in the format dropdown i.e. the "today at
14:23:45" format - the two other date formats are not affected. You also
have to switch the view to "list" mode, in order to see the "modified
date" column.

The issue affects all files that were last modified neither today nor
yesterday. For these files, the correct date is shown. But instead of
the time of the file itself, the current wall clock time is displayed!
So whenever an update of the shown timestamp is triggered, the time is
replaced by the current time (as time goes by).

See the attached screenshot for an example. As one can see, many files
have the very same time, though having different dates. Exceptions are,
as said, files that were modified today ("heute") or yesterday
("gestern") - they have the expected time.

I had a look at the code and it seems that the bug is located in
"libcaja-private/caja-file.c" in the function
"caja_file_fit_date_as_string". While for the two other date formats
everything is fine, the retrieval of the "informal" format is a bit more
complex. It involes a call to localtime which returns a pointer to
struct tm. This pointer is cached for later use. However, the manpage
for ctime warns: "The return value points to a statically allocated
struct which might be overwritten by subsequent calls to any of the date
and time functions." This seems to happen here, due to later date/time
operations.

I'm not sure whether this has already been fixed in later versions, as
the Git history shows later refactoring. At least as a quick fix for
this version, here localtime_r instead of localtime could be used.

** Affects: caja (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "Screenshot"
   
https://bugs.launchpad.net/bugs/1881363/+attachment/5378592/+files/caja_time_bug.png

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1881363

Title:
  Informal date format: wrong time shown

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/caja/+bug/1881363/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to