cactoos icon indicating copy to clipboard operation
cactoos copied to clipboard

Zipping directory is broken

Open piotrkot opened this issue 6 years ago • 12 comments

Let's zip some files.

        final Path folder = new TempFolder("abc").value();
        new LengthOf(
            new TeeInput(
                new InputOf("A"),
                new OutputTo(
                    new File(folder.toFile(), "A.txt")
                )
            )
        ).value();
        new LengthOf(
            new TeeInput(
                new InputOf("B"),
                new OutputTo(
                    new File(folder.toFile(), "B.txt")
                )
            )
        ).value();
        final Path path = new TempFile("abc-compressed-", ".zip").value();
        new LengthOf(
            new TeeInput(
                new InputOf(
                    new Zip(new Directory(folder.toFile())).stream()
                ),
                new OutputTo(path)
            )
        ).value();

Files A.txt and B.txt have expected content and are located in the /tmp/abc directory. Viewing contents with unzip -l abc-compressed-8773065996033619463.zip shows

Archive:  abc-compressed-8773065996033619463.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2020-02-05 20:52   /tmp/abc
        1  2020-02-05 20:52   /tmp/abc/A.txt
        1  2020-02-05 20:52   /tmp/abc/B.txt
---------                     -------
        2                     3 files

which is not expected. I didn't not expect to see /tmp directory in the zip archive. When unzipping the contents with unzip abc-compressed-8773065996033619463.zip -d unzipped/. I get errors and warnings:

Archive:  abc-compressed-8773065996033619463.zip
warning:  stripped absolute path spec from /tmp/abc
  inflating: unzipped/./tmp/abc         
warning:  stripped absolute path spec from /tmp/abc/A.txt
checkdir error:  unzipped/./tmp/abc exists but is not directory
                 unable to process tmp/abc/A.txt.
warning:  stripped absolute path spec from /tmp/abc/B.txt
checkdir error:  unzipped/./tmp/abc exists but is not directory
                 unable to process tmp/abc/B.txt.

Also viewing contents with archive manager (file-roller) shows zipped additional /tmp directory and inside additional 'abc' empty file.

piotrkot avatar Feb 05 '20 20:02 piotrkot

@paulodamaso/z please, pay attention to this issue

0crat avatar Feb 05 '20 20:02 0crat

@piotrkot/z this project will fix the problem faster if you donate a few dollars to it; just click here and pay via Stripe, it's very fast, convenient and appreciated; thanks a lot!

0crat avatar Feb 05 '20 20:02 0crat

@0crat in

paulodamaso avatar Feb 06 '20 00:02 paulodamaso

Bug was reported, see §29: +15 point(s) just awarded to @piotrkot/z

0crat avatar Feb 06 '20 05:02 0crat

The job #1283 assigned to @fanifieiev/z, here is why; the budget is 30 minutes, see §4; please, read §8 and §9; if the task is not clear, read this and this; there will be no monetary reward for this job

0crat avatar Feb 13 '20 18:02 0crat

@0crat wait for #1307 to be merged

fevzian avatar Feb 19 '20 01:02 fevzian

@0crat wait for #1307 to be merged (here)

@fanifieiev The impediment for #1283 was registered successfully by @fanifieiev/z

0crat avatar Feb 19 '20 04:02 0crat

@paulodamaso looks like wait label can be removed as #1307 PR has been merged

sereshqua avatar Mar 29 '20 16:03 sereshqua

The architect of the project has changed; @paulodamaso/z is not at this role anymore; @victornoel/z is the architect now

0crat avatar Jul 05 '20 14:07 0crat

@0crat in

victornoel avatar Sep 13 '20 11:09 victornoel

@0crat status

victornoel avatar Jun 12 '21 14:06 victornoel

@0crat status (here)

@victornoel This is what I know about this job in C63314D6Z, as in §32:

  • The job #1283 is in scope for 9mon
  • The role is DEV
  • The job is not assigned to anyone
  • The budget is not set yet
  • These users are banned and won't be assigned:
    • @piotrkot/z: This user reported the ticket
  • Job footprint (restricted area)

0crat avatar Jun 12 '21 15:06 0crat