extra bytes in zip archive when used with logrotate
Oleg Goldshmidt
pub at goldshmidt.org
Mon Aug 6 21:15:05 IDT 2012
Martha Greenberg <marthag at MIT.EDU> writes:
> Run zip with the -q option. Otherwise, the output of zip ends up in
> the created zip file. You can see this by running strings on the
> zip file, which (without -q) shows:
>
> (deflated 3%)
>
> Adding -q to zip fixes this.
Well, answering both to shimi and to Martha: you are both spot on,
especially Martha - thanks!
Adding -q fixes the problem. I am inserting below the beginning and
the end of "od -c" of the zip archive for illustation.
Now, while the problem is fixed I am not satisfied yet:
1) I have never had to add -q before: zip/unzip have always worked
fine. Why now? The man page does not say anything really
2) It is my script that calls zip - it is not called by logrotate or
anything: why piping from cat or gunzip (used by logrtate) works
fine but piping from logrotate somehow causes the problem? Note
also that the script does not zip stdin directly - it zips a file.
The output of "od -c" follows (sorstdout.log is the actual name of the
log file rotated by logrotate).
----------------- od_begin.txt -------------------------
0000000 P K 003 004 024 \0 \0 \0 \b \0 ! 240 006 A 346 344
0000020 ] 246 256 \n \0 \0 031 357 001 \0 \r \0 034 \0 s o
0000040 r s t d o u t . l o g U T \t \0 003
0000060 M 370 037 P M 370 037 P u x \v \0 001 004 \0 \0
0000100 \0 \0 004 \0 \0 \0 \0 M 370 037 P M 370 037 P u
0000120 x \v \0 001 004 \0 \0 \0 \0 004 \0 \0 \0 \0 355 234
0000140 335 212 \ 327 025 204 } 235 247 350 027 310 244 373 354 275
0000160 316 351 # 204 301 8 276 0 D 6 ( 006 023 206 271 030
0000200 344 216 = $ 232 \t 3 c 210 336 > ] 265 344 374 <
0000220 300 G n 352 303 027 B 3 242 274 , 363 225 004 325 373
0000240 213 / B \b ! 204 020 B \b ! 204 020 B \b ! 204
0000260 020 B \b ! 204 020 B \b ! 204 020 B \b ! 204 020
0000300 B \b ! 204 020 B \b ! 204 020 B \b ! 204 020 B
0000320 \b ! 204 020 B \b ! 204 020 B \b ! 204 020 B \b
----------------- od_end.txt ------------------------------
0005100 200 / 026 T 357 275 341 004 335 \0 366 C 357 275 341 004
0005120 335 \0 366 C 357 275 301 7 021 252 367 336 340 213 005 325
0005140 { o 8 A 7 200 375 320 { o 360 = 201 352 275 7
0005160 233 / 201 357 \t T 357 275 331 004 { \t 354 207 336
0005200 { 263 \t 366 022 330 017 336 { o 340 g 361 313 { 357
0005220 \r 374 244 | y 357 275 201 237 c / 357 275 7 360 s
0005240 354 345 275 7 234 260 350 006 320 | 336 { 303 \t C 7
0005260 200 346 363 336 033 N 230 272 001 4 237 367 336 p B 351
0005300 006 320 | { { 211 2 237 376 260 d / a 237 305 357
0005320 204 353 \r 330 g - 235 / a 237 204 354 204 242 023
0005340 344 % 354 223 220 235 P t 202 274 204 } 022 262 023 t
0005360 003 325 q N 220 ( d e f l a t e d
0005400 9 8 % ) \n P K 001 002 036 003 024 \0 \0 \0 \b
0005420 \0 ! 240 006 A 346 344 ] 246 256 \n \0 \0 031 357 001
0005440 \0 \r \0 030 \0 \0 \0 \0 \0 \0 \0 \0 \0 244 201 \0
0005460 \0 \0 \0 s o r s t d o u t . l o g
0005500 U T 005 \0 003 M 370 037 P u x \v \0 001 004 \0
0005520 \0 \0 \0 004 \0 \0 \0 \0 P K 005 006 \0 \0 \0 \0
0005540 001 \0 001 \0 S \0 \0 \0 365 \n \0 \0 \0 \0
--
Oleg Goldshmidt | pub at goldshmidt.org
More information about the Linux-il
mailing list