Bug 440336 - ark silently fails to extract if filename is too long
Summary: ark silently fails to extract if filename is too long
Status: RESOLVED DOWNSTREAM
Alias: None
Product: ark
Classification: Applications
Component: general (show other bugs)
Version: 21.04.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Elvis Angelaccio
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-27 18:41 UTC by JKFRT
Modified: 2021-08-01 22:13 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Rar archive holding files with very long filenames (1.86 KB, application/vnd.rar)
2021-07-29 15:17 UTC, JKFRT
Details

Note You need to log in before you can comment on or make changes to this bug.
Description JKFRT 2021-07-27 18:41:00 UTC
SUMMARY

If a file in an archive (RAR in my case) has a filename too long, Ark in batch mode fails silently and does not report any error, nor any exit code. 
The file name is less than 255 characters, but has Japanese Unicode characters which ends up being refused by the file system anyway.

STEPS TO REPRODUCE
1. Create an archive with a very long filename
2. Ark -b myarchive.rare

OBSERVED RESULT

The file with a long name is not extracted, but all other files are.

EXPECTED RESULT

An error message in the output (stderr at least), and an exit code that is not 0.


SOFTWARE/OS VERSIONS
Linux: Arch Linux, not using KDE (only i3)
Ark: 21.04.2
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION

I still need to figure out how to create an archive with an illegal filename like this myself.
Comment 1 Albert Astals Cid 2021-07-28 22:29:12 UTC
Could you attach such a file so we don't have to spend time re-creating it?
Comment 2 JKFRT 2021-07-29 15:17:41 UTC
Created attachment 140389 [details]
Rar archive holding files with very long filenames

This archive fails to extract two files due to their file names being too long.
Comment 3 Albert Astals Cid 2021-07-29 21:24:19 UTC
Running 
  ark -b long_filenames_test.rar 

I actually get a warning dialog.
Comment 4 Tony 2021-07-29 21:25:33 UTC
The files with long kanji names can't be extracted.

From journalctl -ex : 

ark.kerfuffle: Failed to move file "/home/joder/Documents/.ark-.QoLCeH/自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か........
Comment 5 JKFRT 2021-07-30 00:55:13 UTC
(In reply to Albert Astals Cid from comment #3)
> Running 
>   ark -b long_filenames_test.rar 
> 
> I actually get a warning dialog.

Interesting. I did not get any dialog. However, I did get the following error in terminal:

Couldn't start kuiserver from org.kde.kuiserver.service: QDBusError("org.freedesktop.DBus.Error.ServiceUnknown", "The name org.kde.kuiserver was not provided by any .service files")

Nothing in system logs however. I'm running Arch Linux, with i3 window manager.

Even then, I should not have to resort to dialog boxes in batch mode (unattended). The exit code is still 0, even though there were some errors (ie. one or more files failed to be extracted), and there is no error message in stdout.

Does it not defeats the purpose of batch mode?
Comment 6 JKFRT 2021-07-30 00:58:30 UTC
I forgot to mention that it is still possible to extract the offending files with the following:

unrar -inul long_filenames_test.rar "自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死 か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か 自由か死か自由か死か自由か死か自由か死か自由か死か.txt.txt" > short_file_name.txt
Comment 7 Albert Astals Cid 2021-07-31 22:21:03 UTC
(In reply to JKFRT from comment #5)
> (In reply to Albert Astals Cid from comment #3)
> > Running 
> >   ark -b long_filenames_test.rar 
> > 
> > I actually get a warning dialog.
> 
> Interesting. I did not get any dialog. However, I did get the following
> error in terminal:
> 
> Couldn't start kuiserver from org.kde.kuiserver.service:
> QDBusError("org.freedesktop.DBus.Error.ServiceUnknown", "The name
> org.kde.kuiserver was not provided by any .service files")

Well, there you go, your installation is broken.
Comment 8 Albert Astals Cid 2021-07-31 22:22:30 UTC
(In reply to JKFRT from comment #6)
> I forgot to mention that it is still possible to extract the offending files
> with the following:
> 
> unrar -inul long_filenames_test.rar
> "自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自
> 由か死か自由か死
> か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自由か死か自
> 由か死か自由か死か自由か死か自由か死か自由か死か自由か死か 自由か死か自由か死か自由か死か自由か死か自由か死か.txt.txt" >
> short_file_name.txt

Yes well, you're renaming the file that's not the same you're asking ark to do :)
Comment 9 JKFRT 2021-08-01 01:06:30 UTC
> Well, there you go, your installation is broken.

My installation is not broken. I'm simply missing a KDE component that is not even part of Ark's dependencies and is not related to the problem which is "batch mode" does not output an error to stdout and the exit code is wrong.

> Yes well, you're renaming the file that's not the same you're asking ark to do :)

I'm asking Ark to extract in batch mode, and return errors codes if there is any.
Ark should at least try to extract the file with a sanitized filename if it makes a point in not returning any error notification.
Comment 10 Albert Astals Cid 2021-08-01 21:32:07 UTC
(In reply to JKFRT from comment #9)
> > Well, there you go, your installation is broken.
> 
> My installation is not broken. I'm simply missing a KDE component that is
> not even part of Ark's dependencies

Well, if missing a component that makes the dialog show when failing is "not broken" for you, fair enough. Also if "this is a thing ark uses" does not qualify as "dependency", fair enough.

> and is not related to the problem which
> is "batch mode" does not output an error to stdout and the exit code is
> wrong.


Who told you the exit code would be not 0? Is it documented somewhere? Because it seems you're just thinking "this would be nice" and when not happening you say "oh this must be a bug".

The only thing batch mode is documented to do is "don't show the ui and directly uncompress"

> 
> > Yes well, you're renaming the file that's not the same you're asking ark to do :)
> 
> I'm asking Ark to extract in batch mode, and return errors codes if there is
> any.
> Ark should at least try to extract the file with a sanitized filename if it
> makes a point in not returning any error notification.

Well, it is showing a notification, if it doesn't show for you, again that's a problem of your installation, nothing we can really fix.
Comment 11 Elvis Angelaccio 2021-08-01 22:13:28 UTC
Please install kuiserver :)

Batch mode is mainly aimed at file managers, not terminals, so it makes sense to error out with a notification instead of a stdout line. But of course patches are welcome to improve the stdout logs too.