ib / xarchiver

(continuation of the Xfce master branch)
GNU General Public License v2.0
171 stars 40 forks source link

Passwords for compressed files #188

Closed pclinuxer closed 9 months ago

pclinuxer commented 10 months ago

Hello:

Don't know if it is an issue 'per se' but I just cannot find a way to password protect a file generated with xarchiver. The file is a *zip which I know can be password protected so that is not a problem.

But once created (obviously with a file inside) Action -> Enter password is greyed out.

This under Linux Devuan Beowulf, PCManFM 1.3.1 and xarchiver 0.5.4.14 .

I have searched all over to no avail. Am I missing something?

Thanks in advance. Best, PCL

ib commented 10 months ago

There is currently no way to password protect an existing archive.

pclinuxer commented 10 months ago

Hello: Thank you for taking the time to write about this. Much appreciated.

There is currently no way to password protect an existing archive.

Indeed ... Actually, it would seem that I was using xarchiver (sort of) wrong.

ie: Via PCManFM 1.3.1 Pointing to select a file and right-clicking/selecting 'Compress ...' and saving it. So I got exactly that: a compressed albeit existing archive.

The proper way (as I have discovered after years of using it wrong) is via the xarchiver application itself. ie: Applications -> Accesories -> xarchiver Archive -> New And so on, etc.

That cleared up, a question if I may to make the PCManFM 1.3.1 'Compress ...' feature more usable.

Would it be possible to make 'Compress ...' open xarchiver just like it does when it is opened from Applications -> Accesories -> xarchiver but with the previously selected file inside it?

That way, you select a file, select 'Compress ...', a new file (not empty but with the previously selected file inside) is generated, a password can then be entered without much ado and the password protected archive saved.

I think it would make xarchiver much more useful as a front end for archiving utilities.

I'm quite willing to run any tests you need.

Thanks in advance.

Best,

PCL

ib commented 10 months ago

Would it be possible to make 'Compress ...' open xarchiver just like it does when it is opened from Applications -> Accesories -> xarchiver but with the previously selected file inside it?

I think changing the behavior in this way would confuse users (and defeat the purpose of the 'Compress ...' interface for file managers). Instead, the option to enter a password should already be included in the New dialog when it is called externally. I will have to think about how to implement this.

pclinuxer commented 10 months ago

Hello: Thank you for taking the time to write back.

... this way would confuse users (and defeat the purpose of the 'Compress ...' interface for file managers).

Yes, I can see your point. ... option to enter a password should already be included in the New dialog ...

If I understand correctly, xarchiver called from PCManFM through the 'Compress ... ' interface would then have a check box (or equivalent) to enable the 'Add password' option within the 'Create a new archive' window.

I will have to think about how to implement this.

Please do, I think that would be a great improvement to xarchiver.

Thank you very much fot taking the time to consider this.

Best,

PCL

ib commented 10 months ago

Do you know how to compile and test from current master?

pclinuxer commented 10 months ago

Hello: Thanks a lot for taking the time for this. Much appreciated.

Do you know how to compile and test from current master?

Well ... Know how to compile is rather optimistic, but I can try to do my best.

I downloaded the xarchiver-master.zip, set it up in my /home and did ~/code/xarchiver/xarchiver-master$ ./configure obtaining what I think is a satisfactory result: xarchiver 0.5.4.22 configured for /usr/local using GTK+ 2.24.32.

I then proceeded to do ~/code/xarchiver/xarchiver-master$ make and got this:

---
make[3]: Leaving directory '/home/groucho/code/xarchiver/xarchiver-master/src/xdgmime'
make[3]: Entering directory '/home/groucho/code/xarchiver/xarchiver-master/src'
  CC       xarchiver-7zip.o
7zip.c: In function 'is7zip_mhe':
7zip.c:68:24: warning: 'sprintf' may write a terminating nul past the end of the destination [-Wformat-overflow=]
    sprintf(fvext, "%03u", i);
                        ^
7zip.c:68:4: note: 'sprintf' output between 4 and 5 bytes into a destination of size 4
    sprintf(fvext, "%03u", i);
    ^~~~~~~~~~~~~~~~~~~~~~~~~
---

Probably related to some issues I have read about with respect to how 7zip deals with its own operations or passwords (?) in Linux but otherwise have no idea. ie: I guess 4 bytes will do fine but 5 bytes into a 4 byte destination is not a whole number.

That said, I have never used 7zip in Linux, there are so many other options for file compression available that I really don't think it makes any difference, at least for me.

I really don't recall having to deal with a *.7z file, maybe in another life and within some MS environment?

Does this need any action from you or can I go ahead and do make install and test?

Best,

PCL

ib commented 10 months ago

You can ignore the warning, there will be no output of more than 3 bytes. The compiler can't know about that.

So yes, you can go ahead, but you don't need to install. You can just call src/xarchiver from where you compiled to run your xarchiver. Give it a try.

But you'll have to wait for the actual test, because the code to be tested is not in master yet. I will provide it to you here as a patch within the next few days.

pclinuxer commented 10 months ago

Hello:

ignore the warning, there will be no output of more than 3 bytes

Note taken.

... call src/xarchiver from where you compiled to run your xarchiver. Give it a try.

Will do. I expect it works just like the version I have installed. ie: 5.4.14-1, from the Devuan/Debian repositories. At first sight, it does.

... wait for the actual test ... ... code to be tested is not in master ... ... will provide it to you here as a patch ...

OK But I have no idea how to do/apply a 'patch', you would have to explain how.

Thanks in advance.

Best,

PCL

ib commented 9 months ago

It's in master now.

You can test it by compiling yourself and running pcmanfm from the command line there:

export PATH=$PWD/src:$PATH
pcmanfm
pclinuxer commented 9 months ago

Hello:

It's in master now.

And it is installed now. 8^) Works exactly as I thought it would.

Hopefully every xarchiver user will find it as useful as I have.

Thank you very much for taking the time to work on this. Greatly appreciated.

Best,

PCL