exit code: 0 if encrypted, 10 (EXIT_CODE_NOT_ENCRYPTED) if not encrypted, else error (errors aren't expected though)
Note that script expects valid .7z archive file as second argument (I see no reason to detect is it .7z file or not because it is already done in your code. Am I right?)
There is some «optimisations» done – we are terminating 7z process after successful detection or after listing header is complete (MAX_READ_LINES). Or after READ_TIMEOUT seconds.
I've checked script running in bash sh mode and busybox sh. Hope it means enough compatibility level.
Also I've checked the earliest 7z version available for me (9.20), listing header format is same as 16.02, though file-roller code seems to expect another header format in addition. Maybe we should investigate it?
Right now I haven't implemented forced line-buffering yet, but it will be done soon.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You're right, the same way as in xa_7zip_extract and sibling functions – construct command string and run command (but in synchronious way). What else may be expected?
Last edit: beelzebubbie 2016-10-15
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yep, you are right. Too many days have passed since I coded it ;) I will
write a patch as soon as I can. Thank you for your kind support, Ettore. I
hope to improve Xarchiver always more and more with the help of the
community!
Hope I solve buffering ambiguity soon and update the script accordingly.
About improving – seems the only way to really improve something is to switch to libarchive. But before we need to design a good abstraction layer above it.
Btw, who is Ettore? :-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well done! How to run this shell script from within Xarchiver now? I also
noticed some variables to be defined.
Giuseppe
/bin/sh detect_7z_encrypt.sh /path/to/detected/7z_binary /path/to/archive
exit code: 0 if encrypted, 10 (EXIT_CODE_NOT_ENCRYPTED) if not encrypted, else error (errors aren't expected though)
Note that script expects valid .7z archive file as second argument (I see no reason to detect is it .7z file or not because it is already done in your code. Am I right?)
There is some «optimisations» done – we are terminating 7z process after successful detection or after listing header is complete (MAX_READ_LINES). Or after READ_TIMEOUT seconds.
I've checked script running in bash sh mode and busybox sh. Hope it means enough compatibility level.
Also I've checked the earliest 7z version available for me (9.20), listing header format is same as 16.02, though file-roller code seems to expect another header format in addition. Maybe we should investigate it?
Right now I haven't implemented forced line-buffering yet, but it will be done soon.
I thought the detection would be performed inside xarchiver....
Giuseppe
You're right, the same way as in xa_7zip_extract and sibling functions – construct command string and run command (but in synchronious way). What else may be expected?
Last edit: beelzebubbie 2016-10-15
Yep, you are right. Too many days have passed since I coded it ;) I will
write a patch as soon as I can. Thank you for your kind support, Ettore. I
hope to improve Xarchiver always more and more with the help of the
community!
Giuseppe
Hope I solve buffering ambiguity soon and update the script accordingly.
About improving – seems the only way to really improve something is to switch to libarchive. But before we need to design a good abstraction layer above it.
Btw, who is Ettore? :-)