Bug 329438

Summary: Rename function with Date & Time does not work with NTFS
Product: [Applications] digikam Reporter: Jean-Pierre <jpr473>
Component: AdvancedRename-ImportAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: bjoernv, caulier.gilles, kinnalru, metzpinguin
Priority: NOR    
Version: 6.0.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In: 6.2.0
Sentry Crash Report:

Description Jean-Pierre 2013-12-30 19:52:29 UTC
Renaming with date time ISO format does not work. It fails on a single file and multiple files as well. Rename attemps with camera type worked. On linux Ubuntu it works fine but not on this version of Digikam & KDE (4.10.2)

Result is a pop-up windows with error:  "Could not rename file C:/such and such folder & directory..."

Renaming with Time & Date Standard format worked but not the ISO format.

Thank you,

Reproducible: Always

Steps to Reproduce:
1. Select picture to rename
2. Invoke Rename function
3. Click on Date & Time / Select ISO format.
Actual Results:  
Failed to rename

Expected Results:  
Rename to ISO format.

I am running Digikam on a WinXP machine
Comment 1 Samoilenko Yuri 2014-01-04 21:43:55 UTC
As far as I know ISO format using such timestamp: "YYYY-MM-DDTHH:MM:SS", but symbol ":" is not allowed for ntfs/windows.
Comment 2 caulier.gilles 2015-01-25 11:43:07 UTC
Git commit 7f3459d55dd453f257ece35398175bba22ea4109 by Gilles Caulier.
Committed on 25/01/2015 at 11:39.
Pushed by cgilles into branch 'master'.

Apply patch #90637 from Maik Qualmann to fix image renaming settings rules in Import Tool to work properly while downloading.
Related: bug 342996, bug 314441, bug 307253, bug 342430
FIXED-IN: 4.7.0

M  +3    -1    NEWS
M  +2    -2    utilities/importui/backend/cameracontroller.cpp
M  +67   -44   utilities/importui/main/importui.cpp
M  +1    -0    utilities/importui/main/importui.h
M  +5    -0    utilities/importui/views/importview.cpp
M  +1    -0    utilities/importui/views/importview.h

http://commits.kde.org/digikam/7f3459d55dd453f257ece35398175bba22ea4109
Comment 3 caulier.gilles 2015-01-25 14:01:06 UTC
Git commit 0201e6fc8549ac849029daf36eaeadd6ebb4d4ae by Gilles Caulier.
Committed on 25/01/2015 at 13:58.
Pushed by cgilles into branch 'frameworks'.

Backport commit #7f3459d55dd453f257ece35398175bba22ea4109 from git/master to frameworks branch.
Related: bug 342996, bug 314441, bug 307253, bug 342430

M  +3    -3    utilities/importui/backend/cameracontroller.cpp
M  +74   -50   utilities/importui/main/importui.cpp
M  +1    -0    utilities/importui/main/importui.h
M  +5    -0    utilities/importui/views/importview.cpp
M  +1    -0    utilities/importui/views/importview.h

http://commits.kde.org/digikam/0201e6fc8549ac849029daf36eaeadd6ebb4d4ae
Comment 4 caulier.gilles 2015-03-26 07:00:12 UTC
digiKam 4.7.0 for Windows is available :

http://download.kde.org/stable/digikam/digiKam-installer-4.7.0-1-win32.exe.mirrorlist

Please test and report.

Thanks in advance

Gilles Caulier
Comment 5 caulier.gilles 2015-07-06 07:38:03 UTC
digiKam 4.11.0 Windows installer is available for download :

http://download.kde.org/stable/digikam/digiKam-installer-4.11.0-win32.exe.mirrorlist
Comment 6 caulier.gilles 2016-06-09 15:39:48 UTC
New digiKam 5.0.0-beta7 installer for Windows is available for testing :

https://drive.google.com/open?id=0B7yq-xFihT0_SzhxVzF1RDhPbFE

Please report if problem remain with this version.

Thanks in advance

Gilles Caulier
Comment 7 caulier.gilles 2016-07-04 20:09:47 UTC
This file still valid using digiKam 5.0.0 ?

Gilles Caulier
Comment 8 caulier.gilles 2016-11-25 06:56:38 UTC
This problem still reproducible using last DK 5.4.0 bundle ?

https://drive.google.com/drive/folders/0BzeiVr-byqt5Y0tIRWVWlRJenM

Gilles Caulier
Comment 9 Maik Qualmann 2018-04-15 08:12:44 UTC
Git commit 2d8d7be73d4b81ed298cd21edae2a7350128fb48 by Maik Qualmann.
Committed on 15/04/2018 at 08:10.
Pushed by mqualmann into branch 'master'.

we always replace the colon to avoid problems with Windows file systems
Related: bug 391312
FIXED-IN: 6.0.0

M  +2    -1    NEWS
M  +0    -6    core/libs/album/albumpropsedit.cpp
M  +1    -5    core/utilities/advancedrename/advancedrenamemanager.cpp

https://commits.kde.org/digikam/2d8d7be73d4b81ed298cd21edae2a7350128fb48
Comment 10 bjoernv 2018-08-16 18:36:32 UTC
I think, it would be better to replace the colon character unconditionally, not only on the Windows platform. Linux users often want to share photos with Windows users or want to save photos on a medium which is also accessed by Windows computers.
Comment 11 Maik Qualmann 2018-08-16 19:00:29 UTC
The current implementation already looks different. It queries the file system, whether it is a FAT* or NTFS* file system. It will also replace a whole host of other characters that Windows does not support. In this way, Linux users can continue to use a colon. If from Linux has special characters in the file name and it is to be copied to a Windows file system, then an export tool must correct the file names.

Maik
Comment 12 bjoernv 2018-08-19 20:41:55 UTC
The strategy is good, but does not reliable work on Linux.

    if (sysType.contains(QLatin1String("FAT")) ||
        sysType.contains(QLatin1String("NTFS")))
    {
        QRegExp regexp(QLatin1String("[?*<>,\\+:=/\";|]"));
        newName.replace(regexp, QLatin1String("_"));
    }

The current code tests for the filesystems "FAT" and "NTFS". On Linux "FAT" filesystems show the name "vfat" in QStorageInfo. NTFS shows as "fuseblk" in QStorageInfo, if NTFS is mounted with "ntfs-3g" like most distributions do. Unfortunately "fuseblk" does not necessarily mean, the it is a NTFS filesystem. There are many FUSE filesystems.

"vfat" is OK, because "FAT" matches the uppercase word "VFAT". For NTFS (ntfs-3g) we need a solution. (Hint: "lsblk -no name,fstype" detects NTFS correctly - see https://unix.stackexchange.com/questions/332712/how-do-i-find-out-what-filesystem-fuse-is-using)

I also do not understand, why "/" is not filtered on Linux. \ / : * ? " < > | are legal characters in Linux filenames (only / and NUL are illegal), but will cause problems anyway, e.g. in the shell.

ReFS and exFAT are also not considered by the code.

The easiest solution is still to filter all possible illegal characters unconditionally.
Comment 13 Maik Qualmann 2018-08-20 06:40:51 UTC
Generally removing all characters that are not allowed under Windows is not the right solution. Then we have the next bug report from a Linux user who has always used the colon in his file name. At the moment I tend to put "fuseblk" on the blacklist too. The slash "/" is already internally filtered, it can not be entered in the input field, filtering in the result string is not necessary.

Maik
Comment 14 bjoernv 2018-08-20 19:58:30 UTC
(In reply to Maik Qualmann from comment #13)
> Then we have the next bug report from a Linux user who
> has always used the colon in his file name. [...]The slash "/" is already 
> internally filtered, it can not be entered in the input field, filtering
> in the result string is not necessary.

I think, not much people will use characters like ":" and "*" for filenames, but those characters can be part of the variables, e.g. EXIF variables. I searched for this bug report, because I wanted to insert date+time in the filename, because this makes it possible to sort photos easily by date/time. Unfortunately this does not work with Digikam 5.9.0 + Linux + VFAT media, because [meta:Exif.Image.DateTime] produces filenames with colons (e.g. 2016:12:27 18:54:23.jpg)
Comment 15 caulier.gilles 2018-08-28 19:06:35 UTC
The Windows installer have been recompiled with last changes from source code and is available here for testing :

https://files.kde.org/digikam/

Take a care : it's a beta release. Make a database backup before to test.

Gilles Caulier