Bug 451203 - Creating archives from files without a common name prefixes are just named "archive" instead of the folder name.
Summary: Creating archives from files without a common name prefixes are just named "a...
Status: REPORTED
Alias: None
Product: ark
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Elvis Angelaccio
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-06 17:39 UTC by Natalie Clarius
Modified: 2022-07-30 09:43 UTC (History)
5 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Natalie Clarius 2022-03-06 17:39:01 UTC
As of v22.04, the name of an archive created from multiple files will be based on the files' common prefix if they have one, and "archive" otherwise. The former is fine, the latter i.m.o. is not an improvement but a regression. This is a request to revert this change, and name an archive by the name of the parent folder and not "archive" when no more specific name can be found.

From https://www.reddit.com/r/kde/comments/t72ir1/comment/hzhz7vw/?utm_source=share&utm_medium=web2x&context=3:

The folder name was much more informative in that case. [...]  

> The reasoning here is that the containing directory is not always relevant for an archive name  [...]
Throwing completely unrelated files together and giving it a name about something entirely different would be a very strange way of using folders, and not something most normal users do. The whole point of using folders is to group together and label contents that are related. "Archive" for a file name is never more relevant than the folder it comes from.
 
That it is an archive is already obvious from the file extension and the file type icon. So naming it "archive" can not possibly add more informativity than the folder name. Even in cases where the folder name is not very expressive, like a number, it is still more informative than "archive", because that way I at least know where the archive is coming from.

Zipping a bunch of files from different subdirectories of a common grandparent directory, then moving or uploading them together to a common place, is something rather common for me to do. Having 12 files just labeled "archive.zip", possibly auto-renamed because the file names will conflict, with no way to tell which is which, is going to be really annoying. I hope this will be changed back.

(End of quote.)

See also the upvotes on the first comment for users sharing this opinition.
Comment 1 Méven Car 2022-03-09 07:07:15 UTC
There was no consensus or majority apparent for users who expressed their opinions in their votes.
In fact most users who voted in the discussion seem to see the new behavior as good, but this was no proper poll.

> Throwing completely unrelated files together and giving it a name about something entirely different would be a very strange way of using folders, and not something most normal users do

We cannot make assumptions on how users are disciplined in creating semantically relevant folders and storing only files relating to that.
That's the error previous behavior did.

How about the Downloads folder ?
How about a Videos dirs containing subtitles ?
A document directory containing photos ? 

> Zipping a bunch of files from different subdirectories of a common grandparent directory, then moving or uploading them together to a common place, is something rather common for me to do. Having 12 files just labeled "archive.zip", possibly auto-renamed because the file names will conflict, with no way to tell which is which, is going to be really annoying. 

I don't understand the workflow exactly.
It seems this can be achieved using a few rename F2 or using ark.
The change made this workflow less convenient for sure.
But we can't base behaviors on one user particular workflow. 

On the other how many users confusion will be alleviated by the change ?

Relevant MR https://invent.kde.org/utilities/ark/-/merge_requests/101
Comment 2 Natalie Clarius 2022-03-14 19:58:04 UTC
(In reply to Méven Car from comment #1)
> There was no consensus or majority apparent for users who expressed their
> opinions in their votes.
> In fact most users who voted in the discussion seem to see the new behavior
> as good, but this was no proper poll.

Looks like we're seeing different votes counts then. But yes, it is not very representative of course.

> We cannot make assumptions on how users are disciplined in creating
> semantically relevant folders and storing only files relating to that.

I don't follow along with how making the assumption that users are undisciplined is warranted then.

> How about the Downloads folder ?
> How about a Videos dirs containing subtitles ?
> A document directory containing photos ? 

I would think that in all those cases, if that's where users find their original files then that's what most effectively indicates where the archive is coming from; more effective than "archive" at least. I don't think that someone who isn't confused by putting their subtitles in a video folder would be confused by an archive of the same name containing these files, or to have an archive consisting of downloaded files to be named "Downloads.zip". But of course I can only answer your questions from my own perspective.

> I don't understand the workflow exactly.
> It seems this can be achieved using a few rename F2 or using ark.
> The change made this workflow less convenient for sure.
> But we can't base behaviors on one user particular workflow. 

Sure. Hence this issue, to officially indicate interest and have a place for people to voice their opinion. If it turns out that noone supports a revert to the old behavior, then that's a valid outcome.

> Relevant MR https://invent.kde.org/utilities/ark/-/merge_requests/101

Thanks. I think the preceding discussion addresses all arguments made there.
Comment 3 Frederick Yin 2022-07-29 09:05:05 UTC
So I was compressing some files today, and I noticed something I thought was a bug but is actually related to this thread.

Versions: Ark 22.04.3, Dolphin 22.04.3, Plasma 5.25.3, KF 5.96.0, Qt 5.15.5 on Arch Linux, kernel 5.18.14

Steps to reproduce:
1. Create two files named "abcde.c" and "abcde.h" in dolphin
2. Select both, then right click
3. Hover on "Compress"
Expected behavior: context menu provides sensible filenames like "abcde.tar.gz"
Observed behavior: the filenames are "abcde..tar.gz" and "abcde..zip" (two dots)

I read the source code and it should be related to the algorithm to find common prefixes (https://invent.kde.org/utilities/ark/-/blob/master/kerfuffle/addtoarchive.cpp#L205). If the last common character is '.', it will precede another '.' and make the filename appear weird to anyone who hasn't seen the code. I think we should fix it as a special case.

If it sounds good to you I'll begin writing a patch soon.
Comment 4 Méven Car 2022-07-30 09:31:47 UTC
(In reply to Frederick Yin from comment #3)
> So I was compressing some files today, and I noticed something I thought was
> a bug but is actually related to this thread.
> 
> Versions: Ark 22.04.3, Dolphin 22.04.3, Plasma 5.25.3, KF 5.96.0, Qt 5.15.5
> on Arch Linux, kernel 5.18.14
> 
> Steps to reproduce:
> 1. Create two files named "abcde.c" and "abcde.h" in dolphin
> 2. Select both, then right click
> 3. Hover on "Compress"
> Expected behavior: context menu provides sensible filenames like
> "abcde.tar.gz"
> Observed behavior: the filenames are "abcde..tar.gz" and "abcde..zip" (two
> dots)

Prefer reporting another bug next time ;-) This is a completely different issue.
Bugs report are not conversations, they aim to gather information to resolve the bug, or discuss the resolution.
> 
> I read the source code and it should be related to the algorithm to find
> common prefixes
> (https://invent.kde.org/utilities/ark/-/blob/master/kerfuffle/addtoarchive.
> cpp#L205). If the last common character is '.', it will precede another '.'
> and make the filename appear weird to anyone who hasn't seen the code. I
> think we should fix it as a special case.
> 
> If it sounds good to you I'll begin writing a patch soon.

You got it right, patch welcome.
I would special case, this line to avoid appending '.' when base already ends with '.' :
https://invent.kde.org/utilities/ark/-/blob/master/kerfuffle/addtoarchive.cpp#L254
Comment 5 Frederick Yin 2022-07-30 09:43:05 UTC
(In reply to Méven Car from comment #4)
> (In reply to Frederick Yin from comment #3)
> > So I was compressing some files today, and I noticed something I thought was
> > a bug but is actually related to this thread.
> > 
> > Versions: Ark 22.04.3, Dolphin 22.04.3, Plasma 5.25.3, KF 5.96.0, Qt 5.15.5
> > on Arch Linux, kernel 5.18.14
> > 
> > Steps to reproduce:
> > 1. Create two files named "abcde.c" and "abcde.h" in dolphin
> > 2. Select both, then right click
> > 3. Hover on "Compress"
> > Expected behavior: context menu provides sensible filenames like
> > "abcde.tar.gz"
> > Observed behavior: the filenames are "abcde..tar.gz" and "abcde..zip" (two
> > dots)
> 
> Prefer reporting another bug next time ;-) This is a completely different
> issue.
> Bugs report are not conversations, they aim to gather information to resolve
> the bug, or discuss the resolution.

Sorry for bringing this one off-topic. I went ahead to file another bug request later (#457269), *but* it turns out someone thought of this ahead of me and sparked a discussion involving the randomness of user behavior (invent MR !120, https://invent.kde.org/utilities/ark/-/merge_requests/120).

> > 
> > I read the source code and it should be related to the algorithm to find
> > common prefixes
> > (https://invent.kde.org/utilities/ark/-/blob/master/kerfuffle/addtoarchive.
> > cpp#L205). If the last common character is '.', it will precede another '.'
> > and make the filename appear weird to anyone who hasn't seen the code. I
> > think we should fix it as a special case.
> > 
> > If it sounds good to you I'll begin writing a patch soon.
> 
> You got it right, patch welcome.
> I would special case, this line to avoid appending '.' when base already
> ends with '.' :
> https://invent.kde.org/utilities/ark/-/blob/master/kerfuffle/addtoarchive.
> cpp#L254

I wrote a patch locally and got it working, but I would abstain from pushing just yet and observe how the MR goes. Thanks for your support!