Tcl Library Source Code

Check-in [870b1002a4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fix: ticket b01462dff7, integrated from branch. version bumped. testsuite extended. doc regenerated.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk | main
Files: files | file ages | folders
SHA3-256: 870b1002a46607b246fd5cd767e7258bbece815c7e0d155359588e92857ddb41
User & Date: aku 2025-01-15 19:49:31.281
References
2025-01-15
19:51 Closed ticket [b01462dff7]: untar: expected integer but got a list plus 8 other changes artifact: e310969b3d user: aku
Context
2025-02-09
15:47
Fixed a typo in permutations proc. check-in: 61f5d52a95 user: arjenmarkus tags: trunk, main
2025-01-15
19:49
fix: ticket b01462dff7, integrated from branch. version bumped. testsuite extended. doc regenerated. check-in: 870b1002a4 user: aku tags: trunk, main
2025-01-14
22:20
Added testcase demonstrating issue and fix Closed-Leaf check-in: c6a7152cd0 user: aku tags: bug-b01462dff7
2025-01-04
18:37
Correct mistakes in the man page for the filter package. check-in: ce253d70e3 user: arjenmarkus tags: trunk, main
Changes
Unified Diff Ignore Whitespace Patch
Changes to embedded/md/tcllib/files/modules/tar/tar.md.
1
2
3
4
5
6
7
8
9
10
11

[//000000001]: # (tar \- Tar file handling)
[//000000002]: # (Generated from file 'tar\.man' by tcllib/doctools with format 'markdown')
[//000000003]: # (tar\(n\) 0\.13 tcllib "Tar file handling")

<hr> [ <a href="../../../../toc.md">Main Table Of Contents</a> &#124; <a
href="../../../toc.md">Table Of Contents</a> &#124; <a
href="../../../../index.md">Keyword Index</a> &#124; <a
href="../../../../toc0.md">Categories</a> &#124; <a
href="../../../../toc1.md">Modules</a> &#124; <a
href="../../../../toc2.md">Applications</a> ] <hr>



|







1
2
3
4
5
6
7
8
9
10
11

[//000000001]: # (tar \- Tar file handling)
[//000000002]: # (Generated from file 'tar\.man' by tcllib/doctools with format 'markdown')
[//000000003]: # (tar\(n\) 0\.14 tcllib "Tar file handling")

<hr> [ <a href="../../../../toc.md">Main Table Of Contents</a> &#124; <a
href="../../../toc.md">Table Of Contents</a> &#124; <a
href="../../../../index.md">Keyword Index</a> &#124; <a
href="../../../../toc0.md">Categories</a> &#124; <a
href="../../../../toc1.md">Modules</a> &#124; <a
href="../../../../toc2.md">Applications</a> ] <hr>
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
  - [Keywords](#keywords)

  - [Category](#category)

# <a name='synopsis'></a>SYNOPSIS

package require Tcl 8\.5 9  
package require tar ?0\.13?  

[__::tar::contents__ *tarball* ?__\-chan__? ?__\-gzip__?](#1)  
[__::tar::stat__ *tarball* ?file? ?__\-chan__? ?__\-gzip__?](#2)  
[__::tar::untar__ *tarball* *args*](#3)  
[__::tar::get__ *tarball* *fileName* ?__\-chan__? ?__\-gzip__?](#4)  
[__::tar::create__ *tarball* *files* *args*](#5)  
[__::tar::add__ *tarball* *files* *args*](#6)  







|







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
  - [Keywords](#keywords)

  - [Category](#category)

# <a name='synopsis'></a>SYNOPSIS

package require Tcl 8\.5 9  
package require tar ?0\.14?  

[__::tar::contents__ *tarball* ?__\-chan__? ?__\-gzip__?](#1)  
[__::tar::stat__ *tarball* ?file? ?__\-chan__? ?__\-gzip__?](#2)  
[__::tar::untar__ *tarball* *args*](#3)  
[__::tar::get__ *tarball* *fileName* ?__\-chan__? ?__\-gzip__?](#4)  
[__::tar::create__ *tarball* *files* *args*](#5)  
[__::tar::add__ *tarball* *files* *args*](#6)  
Changes to idoc/man/files/modules/tar/tar.n.
1
2
3
4
5
6
7
8
9
10
11
'\"
'\" Generated from file 'tar\&.man' by tcllib/doctools with format 'nroff'
'\"
.TH "tar" n 0\&.13 tcllib "Tar file handling"
.\" The -*- nroff -*- definitions below are for supplemental macros used
.\" in Tcl/Tk manual entries.
.\"
.\" .AP type name in/out ?indent?
.\"	Start paragraph describing an argument to a library procedure.
.\"	type is type of argument (int, etc.), in/out is either "in", "out",
.\"	or "in/out" to describe whether procedure reads or modifies arg,



|







1
2
3
4
5
6
7
8
9
10
11
'\"
'\" Generated from file 'tar\&.man' by tcllib/doctools with format 'nroff'
'\"
.TH "tar" n 0\&.14 tcllib "Tar file handling"
.\" The -*- nroff -*- definitions below are for supplemental macros used
.\" in Tcl/Tk manual entries.
.\"
.\" .AP type name in/out ?indent?
.\"	Start paragraph describing an argument to a library procedure.
.\"	type is type of argument (int, etc.), in/out is either "in", "out",
.\"	or "in/out" to describe whether procedure reads or modifies arg,
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
..
.BS
.SH NAME
tar \- Tar file creation, extraction & manipulation
.SH SYNOPSIS
package require \fBTcl 8\&.5 9\fR
.sp
package require \fBtar ?0\&.13?\fR
.sp
\fB::tar::contents\fR \fItarball\fR ?\fB-chan\fR? ?\fB-gzip\fR?
.sp
\fB::tar::stat\fR \fItarball\fR ?file? ?\fB-chan\fR? ?\fB-gzip\fR?
.sp
\fB::tar::untar\fR \fItarball\fR \fIargs\fR
.sp







|







271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
..
.BS
.SH NAME
tar \- Tar file creation, extraction & manipulation
.SH SYNOPSIS
package require \fBTcl 8\&.5 9\fR
.sp
package require \fBtar ?0\&.14?\fR
.sp
\fB::tar::contents\fR \fItarball\fR ?\fB-chan\fR? ?\fB-gzip\fR?
.sp
\fB::tar::stat\fR \fItarball\fR ?file? ?\fB-chan\fR? ?\fB-gzip\fR?
.sp
\fB::tar::untar\fR \fItarball\fR \fIargs\fR
.sp
Changes to idoc/www/tcllib/files/modules/tar/tar.html.
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
&#124; <a href="../../../toc.html">Table Of Contents</a>
&#124; <a href="../../../../index.html">Keyword Index</a>
&#124; <a href="../../../../toc0.html">Categories</a>
&#124; <a href="../../../../toc1.html">Modules</a>
&#124; <a href="../../../../toc2.html">Applications</a>
 ] <hr>
<div class="doctools">
<h1 class="doctools_title">tar(n) 0.13 tcllib &quot;Tar file handling&quot;</h1>
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
<p>tar - Tar file creation, extraction &amp; manipulation</p>
</div>
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="doctools_toc">
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li>
<li class="doctools_section"><a href="#section1">Description</a></li>
<li class="doctools_section"><a href="#section2">BEWARE</a></li>
<li class="doctools_section"><a href="#section3">COMMANDS</a></li>
<li class="doctools_section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="doctools_section"><a href="#keywords">Keywords</a></li>
<li class="doctools_section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="doctools_synopsis">
<ul class="doctools_requirements">
<li>package require <b class="pkgname">Tcl 8.5 9</b></li>
<li>package require <b class="pkgname">tar <span class="opt">?0.13?</span></b></li>
</ul>
<ul class="doctools_syntax">
<li><a href="#1"><b class="cmd">::tar::contents</b> <i class="arg">tarball</i> <span class="opt">?<b class="option">-chan</b>?</span> <span class="opt">?<b class="option">-gzip</b>?</span></a></li>
<li><a href="#2"><b class="cmd">::tar::stat</b> <i class="arg">tarball</i> <span class="opt">?file?</span> <span class="opt">?<b class="option">-chan</b>?</span> <span class="opt">?<b class="option">-gzip</b>?</span></a></li>
<li><a href="#3"><b class="cmd">::tar::untar</b> <i class="arg">tarball</i> <i class="arg">args</i></a></li>
<li><a href="#4"><b class="cmd">::tar::get</b> <i class="arg">tarball</i> <i class="arg">fileName</i> <span class="opt">?<b class="option">-chan</b>?</span> <span class="opt">?<b class="option">-gzip</b>?</span></a></li>
<li><a href="#5"><b class="cmd">::tar::create</b> <i class="arg">tarball</i> <i class="arg">files</i> <i class="arg">args</i></a></li>







|



















|







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
&#124; <a href="../../../toc.html">Table Of Contents</a>
&#124; <a href="../../../../index.html">Keyword Index</a>
&#124; <a href="../../../../toc0.html">Categories</a>
&#124; <a href="../../../../toc1.html">Modules</a>
&#124; <a href="../../../../toc2.html">Applications</a>
 ] <hr>
<div class="doctools">
<h1 class="doctools_title">tar(n) 0.14 tcllib &quot;Tar file handling&quot;</h1>
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
<p>tar - Tar file creation, extraction &amp; manipulation</p>
</div>
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="doctools_toc">
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li>
<li class="doctools_section"><a href="#section1">Description</a></li>
<li class="doctools_section"><a href="#section2">BEWARE</a></li>
<li class="doctools_section"><a href="#section3">COMMANDS</a></li>
<li class="doctools_section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="doctools_section"><a href="#keywords">Keywords</a></li>
<li class="doctools_section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="doctools_synopsis">
<ul class="doctools_requirements">
<li>package require <b class="pkgname">Tcl 8.5 9</b></li>
<li>package require <b class="pkgname">tar <span class="opt">?0.14?</span></b></li>
</ul>
<ul class="doctools_syntax">
<li><a href="#1"><b class="cmd">::tar::contents</b> <i class="arg">tarball</i> <span class="opt">?<b class="option">-chan</b>?</span> <span class="opt">?<b class="option">-gzip</b>?</span></a></li>
<li><a href="#2"><b class="cmd">::tar::stat</b> <i class="arg">tarball</i> <span class="opt">?file?</span> <span class="opt">?<b class="option">-chan</b>?</span> <span class="opt">?<b class="option">-gzip</b>?</span></a></li>
<li><a href="#3"><b class="cmd">::tar::untar</b> <i class="arg">tarball</i> <i class="arg">args</i></a></li>
<li><a href="#4"><b class="cmd">::tar::get</b> <i class="arg">tarball</i> <i class="arg">fileName</i> <span class="opt">?<b class="option">-chan</b>?</span> <span class="opt">?<b class="option">-gzip</b>?</span></a></li>
<li><a href="#5"><b class="cmd">::tar::create</b> <i class="arg">tarball</i> <i class="arg">files</i> <i class="arg">args</i></a></li>
Changes to modules/tar/tar.man.
1
2
3
4
5
6
7
8
9
[comment {-*- mode: tcl ; fill-column: 80 -*- doctools manpage}]
[vset PACKAGE_VERSION 0.13]
[manpage_begin tar n [vset PACKAGE_VERSION]]
[keywords archive]
[keywords {tape archive}]
[keywords tar]
[moddesc   {Tar file handling}]
[titledesc {Tar file creation, extraction & manipulation}]
[category  {File formats}]

|







1
2
3
4
5
6
7
8
9
[comment {-*- mode: tcl ; fill-column: 80 -*- doctools manpage}]
[vset PACKAGE_VERSION 0.14]
[manpage_begin tar n [vset PACKAGE_VERSION]]
[keywords archive]
[keywords {tape archive}]
[keywords tar]
[moddesc   {Tar file handling}]
[titledesc {Tar file creation, extraction & manipulation}]
[category  {File formats}]
Changes to modules/tar/tar.tcl.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Copyright (c) 2024    Christian Werner <[email protected]>
#                       (zlib support).
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.

package require Tcl 8.5 9
package provide tar 0.13

# # ## ### ##### ######## ############# #####################
##
# Gzip support
#
# |Id  |Question            |Check                |Notes|
# |---:|:---                |:---                 |:---|







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Copyright (c) 2024    Christian Werner <[email protected]>
#                       (zlib support).
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.

package require Tcl 8.5 9
package provide tar 0.14

# # ## ### ##### ######## ############# #####################
##
# Gzip support
#
# |Id  |Question            |Check                |Notes|
# |---:|:---                |:---                 |:---|
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
	name mode uid gid size mtime cksum type \
	linkname magic version uname gname devmajor devminor prefix

    foreach x {name type linkname} {
        set $x [string trim [set $x] "\x00"]
    }
    foreach x {uid gid size mtime cksum} {
        set $x [format %d 0[string trim [set $x] " \x00"]]
    }
    set mode [string trim $mode " \x00"]

    if {$magic eq "ustar "} {
        # gnu tar
        # not fully supported
        foreach x {uname gname prefix} {
            set $x [string trim [set $x] "\x00"]
        }
        foreach x {devmajor devminor} {
            set $x [format %d 0[string trim [set $x] " \x00"]]
        }
    } elseif {$magic eq "ustar\x00"} {
        # posix tar
        foreach x {uname gname prefix} {
            set $x [string trim [set $x] "\x00"]
        }
        foreach x {devmajor devminor} {
            set $x [format %d 0[string trim [set $x] " \x00"]]
        }
    } else {
        # old style tar
        foreach x {uname gname devmajor devminor prefix} { set $x {} }
        if {$type eq ""} {
            if {[string match */ $name]} {
                set type 5







|










|







|







134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
	name mode uid gid size mtime cksum type \
	linkname magic version uname gname devmajor devminor prefix

    foreach x {name type linkname} {
        set $x [string trim [set $x] "\x00"]
    }
    foreach x {uid gid size mtime cksum} {
        set $x [format %d 0o0[string trim [set $x] " \x00"]]
    }
    set mode [string trim $mode " \x00"]

    if {$magic eq "ustar "} {
        # gnu tar
        # not fully supported
        foreach x {uname gname prefix} {
            set $x [string trim [set $x] "\x00"]
        }
        foreach x {devmajor devminor} {
            set $x [format %d 0o0[string trim [set $x] " \x00"]]
        }
    } elseif {$magic eq "ustar\x00"} {
        # posix tar
        foreach x {uname gname prefix} {
            set $x [string trim [set $x] "\x00"]
        }
        foreach x {devmajor devminor} {
            set $x [format %d 0o0[string trim [set $x] " \x00"]]
        }
    } else {
        # old style tar
        foreach x {uname gname devmajor devminor prefix} { set $x {} }
        if {$type eq ""} {
            if {[string match */ $name]} {
                set type 5
Changes to modules/tar/tar.test.
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136












137
138
139
} -body {
    string trim [tar::get $tarfile 02]
} -cleanup {
    cleanup-tkt-9f4c0e3e95
    unset tarfile
} -result {zero-two}

test tar-tkt-9f4c0e3e95-1.1 {Ticket 9f4c0e3e95, B, } -setup {
    set tarfile [setup-tkt-9f4c0e3e95]
} -body {
    tar::get $tarfile 0b10
} -cleanup {
    cleanup-tkt-9f4c0e3e95
    unset tarfile
} -returnCodes error -result {Tar "tartest/t.tar": File "0b10" not found}













# -------------------------------------------------------------------------
testsuiteCleanup







|







>
>
>
>
>
>
>
>
>
>
>
>



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
} -body {
    string trim [tar::get $tarfile 02]
} -cleanup {
    cleanup-tkt-9f4c0e3e95
    unset tarfile
} -result {zero-two}

test tar-tkt-9f4c0e3e95-1.1 {Ticket 9f4c0e3e95, B} -setup {
    set tarfile [setup-tkt-9f4c0e3e95]
} -body {
    tar::get $tarfile 0b10
} -cleanup {
    cleanup-tkt-9f4c0e3e95
    unset tarfile
} -returnCodes error -result {Tar "tartest/t.tar": File "0b10" not found}

# -------------------------------------------------------------------------

test tar-tkt-b01462dff7-1.0 {Ticket b01462dff7} -setup {
    set tarfile [localPath tests/b01462dff7.tar]
} -body {
    tar::untar $tarfile ; set _ "" ;# squash and ignore untar result
} -cleanup {
    # remove the extracted files
    file delete cp.html fields.c grammar.lsp sum xargs.1
    unset tarfile _
} -result {}

# -------------------------------------------------------------------------
testsuiteCleanup
Added modules/tar/tests/b01462dff7.tar.

cannot compute difference between binary files