Ticket UUID: | b01462dff791ba84ecf444d01281412d781bdfbb | |||
Title: | untar: expected integer but got a list | |||
Type: | Bug | Version: | 2.0 | |
Submitter: | anonymous | Created on: | 2025-01-10 08:20:17 | |
Subsystem: | tar | Assigned To: | andreas_kupries | |
Priority: | 5 Medium | Severity: | Severe | |
Status: | Closed | Last Modified: | 2025-01-15 19:51:48 | |
Resolution: | Fixed | Closed By: | aku | |
Closed on: | 2025-01-15 19:51:48 | |||
Description: |
Hello, I am using Magicsplat distribution for quite some time. One of the options my little app offers is to untar bugreport.tar.gz files generated by Android OS. It seems I had no issues with Magicsplat based on Tcl/Tk 8.6, but when I switched to the latest version based on 9.1, the untar stopped working. I think the older versions used Tcllib 1.2, while the latest one is based on 2.0. I mentioned this issue to Ashok and he suggest to open a ticket here. The error I see is he following: expected integer but got a list while executing "format %d 0[string trim [set $x] " \x00"]" (procedure "readHeader" line 8) invoked from within "readHeader [read $fh 512]" (procedure "::tar::untar" line 22) invoked from within "::tar::untar untar-test.tar" (file "untar-test.tcl" line 3) I was able to reproduce the issue with the following steps: 1. Downloaded and unpacked the tcllib 2.0 sources 2. Tar-ed the resulting folder (used Peazip) into a untar-test.tar 3. Tried to untar with a tcl script: package require tar ::tar::untar untar-test.tar Looks like the untar can unpack one file and then fails. Please let me know if you have any questions. Thanks, Michael | |||
User Comments: |
aku added on 2025-01-15 19:51:48:
Fix merged. See commit [870b1002a4]. Version bumped to 0.14. Thank you for the report. And thanks to Ashok for the fix. aku added on 2025-01-14 22:07:34: My thought that this was an encoding issue was wrong.
The The issue is indeed one of octal conversion, and Ashok's change is a fix. Basically, using pre-patch With the size wrong the code looks at the wrong place in the file for the next header, reads bogus data, and then chokes on that. With the patch applied ( Using the
and mis-converts to
No conversion was done at all. With the path on the other hand we get
which is correct.
And with that I have confirmed the issue, understood the issue, confirmed and understood the fix, and can now extend the testsuite. aku added on 2025-01-14 07:50:14: Thank you for that reference. Will use that to continue my investigation this evening. ... Could not resist, tried already a bit ... Looks to be more of an channel encoding issue. The 8.5 reports that the channel is set to Will have to look into the internal But this really has to be deferred to the evening. anonymous added on 2025-01-14 00:35:33: I just tested using the following file https://corpus.canterbury.ac.nz/resources/cantrbry.tar.gz from here: https://corpus.canterbury.ac.nz/descriptions/ Just ungziped it and then tried to untar using the tcl script. Here is the error I get this time: expected integer but got "0à♥♥☻" while executing "format %d 0[string trim [set $x] " \x00"]" (procedure "readHeader" line 8) invoked from within "readHeader [read $fh 512]" (procedure "::tar::untar" line 22) invoked from within "::tar::untar untar-test.tar" (file "untar-test.tcl" line 3) untar was able to extract the first file and then failed aku added on 2025-01-13 21:05:35: @ apnadkarni Do you have a small test case we could add to the test suite of tar for this ? I have trouble reproducing the issue (before applying your patch). The only time I managed to get something similar was when the tar file contained a symbolic link I had in my tcllib checkout. ... And that failure was with 8.5, and ok for 9.0. ... After applying your (apn's) patch the failure (see below) appears for tcl 9 as well. Ok. After some rummaging around my failure is actually a known limitation of the tar package.
My tarball contained a type Removing these symlinks from my checkout and the tarballs I create with the local GNU tar 1.30 are ok, before and after the applying the patch. So not usable for reproduction, nor as testcase. Is it possible to make one of the failing tarballs available ? I do not have PeaZip. anonymous added on 2025-01-10 13:57:14: Proposed fix in bug-b01462dff7 |
