procmail
[Top] [All Lists]

Re: softlabs

2004-03-04 07:52:02
On Thu, 04 Mar 2004, 03:42 GMT-08 (12:42 local time) Professional
Software Engineering wrote:

At 11:20 2004-03-04 +0100, Robert Allerstorfer wrote:
why so complicated? A one-line condition can first tell you if the ZIP
is encrypted or not:

zipinfo file.zip | sed -ne '2p' | sed -ne 's/^[^ ]* *[^ ]* *[^ ]* *[^ ]*
*\(.\).*/\1/p'

Your "one line" involves a shell, and three program invocations (two of
which could be combined).  Talk about complicated.

Why resort to a command pipeline when it can be performed with a SINGLE
program invocation?

ZIPSTATE=`zipinfo file.zip`

The one-liner I posted is a quick hack to be executed on *the shell*,
and should only demonstrate how the principe of determining a
encrypted ZIP could work directly, without fooling a program and make
the decision based on an error the program may return. It has never
been intended to be used directly in a procmail recipe.

Also, consider what happens if using your suggestion and file.zip
contains thousand or more files (which can even be zero byte ones): a
buffer overflow will most likely arise...

rob.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>