Bug 308465

Summary: TimeAdjust cannot change file modification timestamp for files with non-ASCII characters in path
Product: [Applications] digikam Reporter: Karol Slanina <karol.slanina>
Component: Plugin-Generic-TimeAdjustAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: smit.meh
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 3.0.0
Sentry Crash Report:

Description Karol Slanina 2012-10-15 22:51:36 UTC
TimeAdjust is not able to change the file modification timestamps in case that the filesystem uses UTF-8 (or any non-ASCII or non-Latin1 encoding) and there's a file that has a non-ASCII character in its path. Timestamps for ASCII-only files can be successfully processed though. This bug does not affect timestamps in metadata such as EXIF, IPTC or XMP, which can be successfully modified for all files regardless of the characters in their names.

Reproducible: Always

Steps to Reproduce:
1. Create an image with a non-ASCII character in its name or path, e.g. "Besançon.jpg" or "Kraków.jpg"
2. Try to modify its file last modified timestamp via the TimeAdjust plugin
Actual Results:  
Files with non-ASCII characters cannot be processed (Status = "Failed to update file timestamp"), while files with ASCII only characters are updated successfully (Status = "Processed without error")

Expected Results:  
All files are processed successfully

TimeAdjust plugin assumes that all characters in the file path are encoded with Latin1 encoding:
if (utime(m_url.path().toLatin1().constData(), &times) != 0)

Instead of calling m_url.path().toLatin1().constData(), the conversion to const char* should be done by
QFile::encodeName(m_url.toLocalFile()).constData()
which respects the user's locale.
Comment 1 Smit Mehta 2012-10-16 13:49:28 UTC
Git commit 88341ba21071deeffe7dba1b453e5d6c37253389 by Smit Mehta.
Committed on 16/10/2012 at 15:46.
Pushed by smitmehta into branch 'master'.

Fix for changing file modification timestamp with files having non ASCII characters

M  +2    -1    NEWS
M  +1    -1    timeadjust/actionthread.cpp

http://commits.kde.org/kipi-plugins/88341ba21071deeffe7dba1b453e5d6c37253389