Bug 441964 - Problem with -c (--add) option
Summary: Problem with -c (--add) option
Status: CONFIRMED
Alias: None
Product: ark
Classification: Applications
Component: general (show other bugs)
Version: 20.12.3
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: Elvis Angelaccio
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2021-09-03 19:32 UTC by oolonthegreat
Modified: 2024-11-08 17:31 UTC (History)
4 users (show)

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


Attachments
screenshot with the error (18.62 KB, image/png)
2021-09-03 19:32 UTC, oolonthegreat
Details

Note You need to log in before you can comment on or make changes to this bug.
Description oolonthegreat 2021-09-03 19:32:40 UTC
Created attachment 141275 [details]
screenshot with the error

SUMMARY

When I try to create an archive with user prompt using `ark -c a.txt b.txt` it gives me the error "You need to either supply a filename for the archive or a suffix (such as rar, tar.gz) with the --autofilename argument."

I am confused since I did not use the -f (--autofilename) argument anyway.

Can anyone point me in the right direction to create an archive with selected files? I would like to "query the user for an archive filename", just like the option -c is supposed to work.

STEPS TO REPRODUCE
    ark -c a.txt b.txt

OBSERVED RESULT
   error

EXPECTED RESULT
   query the user for an archive filename


SOFTWARE/OS VERSIONS
Operating System: Kubuntu 21.04
KDE Plasma Version: 5.21.4
KDE Frameworks Version: 5.80.0
Qt Version: 5.15.2
Kernel Version: 5.11.0-31-generic
OS Type: 64-bit
Graphics Platform: X11
Comment 1 Raphael Kubo da Costa 2021-11-14 16:49:52 UTC
I agree the description of the -c argument does not match the actual result (it does say "Query the user for an archive filename [...]"). As a workaround, you can pass -d as well, this shows the file creation dialog where you can enter an archive name.
Comment 2 Werner Kroneman 2024-11-08 15:41:52 UTC
Behavior is immediately reproducible over here, just use -c with any file name.

Not sure if it's a bug? At the very least the help message is incorrect, as it states "Query the user for an archive filename and add specified files to it. Quit when finished."

Ark does not at any point query anything, it just fails with the screenshotted error message.
Comment 3 Werner Kroneman 2024-11-08 15:50:01 UTC
I see two ways out of this:

- easiest: change the text of the help to just say it's to specify the files to add to the archive
- harder, unclear if we want that: actually prompt the user for a filename with a dialog of some sort

The easy option requires just one change in main.cpp and it's more or less what I'd expect a command line tool to behave like.

The line to be changed is here: https://invent.kde.org/utilities/ark/-/blob/master/app/main.cpp?ref_type=heads#L126 (and in all the i18n files)
Comment 4 Werner Kroneman 2024-11-08 15:56:53 UTC
Alternatively, could swap this error in https://invent.kde.org/utilities/ark/-/blob/master/kerfuffle/addtoarchive.cpp?ref_type=heads#L139 for an input prompt of some sort.
Comment 5 Werner Kroneman 2024-11-08 17:31:30 UTC
Working on a fix here: https://invent.kde.org/wkroneman/ark/-/commits/issue-441964

It goes the "prompt the user" roue