Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2024-09-10
12:15 • Closed ticket [b9f3ff8fe6]: Errors/ambiguities in zipfs(n) manual page plus ... artifact: 3bb35ca066 user: tberg
2024-08-05
22:59
also change zipfs.3 to match the resolution of ticket [b9f3ff8fe6] check-in: e49d28592d user: Torsten tags: zipfs-consolidation
22:25 • Ticket [b9f3ff8fe6] Errors/ambiguities in zipfs(n) manual page status still ... artifact: 18462eb520 user: tberg
22:21
resolution of ticket [b9f3ff8fe6] check-in: f6bfd7c52a user: Torsten tags: zipfs-consolidation
2024-08-03
06:16 • Ticket [b9f3ff8fe6] Errors/ambiguities in zipfs(n) manual page status still ... artifact: 54c4ae8822 user: tberg
06:07
correct wrong comment about safe subcommands, don't make zipfs a package anymore (ticket [b9f3ff8fe6... check-in: 9e4b08a4a7 user: Torsten tags: zipfs-consolidation
2024-08-02
21:27 • Ticket [b9f3ff8fe6] Errors/ambiguities in zipfs(n) manual page status still ... artifact: 81628787bc user: tberg
03:21 • Ticket [b9f3ff8fe6]: 3 changes artifact: 91b4562c0a user: griffin
2024-08-01
08:01 • Ticket [b9f3ff8fe6]: 4 changes artifact: f96438d137 user: oehhar
06:30 • Ticket [b9f3ff8fe6]: 3 changes artifact: 6aa17e54f0 user: tberg
2024-07-31
02:51 • Ticket [b9f3ff8fe6]: 3 changes artifact: 648a848992 user: apnadkarni
2024-07-30
07:11 • New ticket [b9f3ff8fe6]. artifact: 093454c956 user: tberg

Errors/ambiguities in zipfs(n) manual page

Closed / Fixedb9f3ff8fe69cae04239a2de23601d51b289dad06Created 2 years agoUpdated 2 years ago
Descriptionmarkdown2024-07-30 07:11:56

Here are some points which I think should be fixed in the zipfs(n) manual page. As I am not totally sure about them, this ticket asks for comments before I just change the manual page.

1. requiring the package

The manual page indicates to use

package require tcl::zipfs ?1.0?

in order to use the zipfs commands. In a normal Tcl9.0b3 interpreter, you can just use the commands without this line. I believe this fact should be documented or rather it should be documented under which circumstances the line is needed. The source code of zipfs does not give me any indication of when the line would be needed. (This is actually true for other packages as well, msgcat e.g.).

2. package version

The manual page states the version is 1.0, the zipfs.c source does:

Tcl_PkgProvide(interp, "tcl::zipfs", "2.0");

Shouldn't the documentation be brought in line with the implementation or is version 2.0 wrong as this is a new package and some aspects are even declared experimental? By the way, the zipfs.test file has a test and also expects "2.0" as result.

3. zipfs mount point

The manual page says the mount point for zipfs volumes is “//zipfs:/” on most platforms. This is a bit too loosely documented as it leaves the user with the burden to find out (using zipfs root). However, I cannot find any indication in the source code of the mount point being platform-dependent. It just says in line 89:

#define ZIPFS_VOLUME "//zipfs:/"

Am I correct that the mount point is actually platform-independent and always the same? If true, this needs fixed in the documentation. If this is not the case, the various possible mount points and the platforms for which they apply should be listed.

4. zipfs mkimg syntax

The [zipfs mkimg] syntax is specified like this:

zipfs mkimg outfile indir ?strip? ?password? ?infile?

This indicates one could leave out any of the three optional parameters and zipfs would figure out what is meant. This is not true. The syntax rather has four different forms:

zipfs mkimg outfile indir
zipfs mkimg outfile indir strip
zipfs mkimg outfile indir strip password
zipfs mkimg outfile indir strip password infile

So, e.g., you cannot really skip ?strip? and then specify ?password? only. When I misunderstand the way such syntax is to be read, then I propose we need a separate manual page explaining how to read Tcl syntax in general (it would be good practice anyway).

If I understand correct, it is not possible to create an unstripped image with a password. At least, this is not documented. Is my impression true? Of course, I can always provide empty strings for the parameters I don't care about but what happens then is not explicitly documented for ?strip?. I would thus rather have the syntax documented as written above instead of with three optional parameters that are not optional in this sense. Any insights?

5. experimental code?

The mkimg subcommand documentation contains the comment: "Caution: highly experimental, not usable on Android, only partially tested on Linux and Windows."

Is is unclear what this means. Which parts are tested and which not? Can the subcommand actually be used? It worked for me using macOS so this could also count as being partly tested. Further, there is an extensive zipfs.test file and testing Tcl9.0b2 and b3 has not resulted in any error being reported on any platform as far as I can tell. Is the sentence obsolete?

Referenced by3
apnadkarnimarkdown2024-07-31 02:51:00

In order,

  1. I think there should be no reason for a package require call as zipfs is part of the core. As Donal said on the mailing list, there is no reason for zlib (and therefore zipfs) not to be part of every Tcl. Also, unlike msgcat, the zipfs command is always present, not loaded on demand. My take would be to fix the documentation.

  2. See above which makes this moot. Removing the Tcl_PkgProvide call has no effect on Tcl and the test suite. The only question is third party extensions rely on it (doubtful since this is new in 8.7/9). My opinion is this line should be deleted so it is not a package at all.

  3. I prefer not to limit what [zipfs root] might be in some future release. There is no reason to document //zipfs:/ is there? People should be encouraged to use [zipfs root] and not hard code a literal.

  4. Have not looked at mkimg. Afaik it is not covered in the test suite at all. Needs further investigation.

  5. I do not know why it is marked experimental. Perhaps because the mechanism of appending the ZIP to the executable is not workable on all executable formats?

tbergmarkdown2024-08-01 06:30:30
  1. Yes, when zipfs is considered part of the core commands, then it should not be a package at all. I agree. The zlib is also not a package.

  2. Agree.

  3. OK, good point and fair argument. I agree that it is the purpose of zipfs root to return the mount point, however it looks like. Removing the //zipfs:/ will also make documentation easier.

  4. You are right, I checked and zipfs mkimg is not covered in the test suite. There should be at least some basic tests there, I believe, also to prove it is working on all platforms when testing the next beta!

  5. Writing some tests as a result of point 4) and getting them into the next beta of Tcl9 would be my preferred way of checking this. When we find problems then and have fixed those, the text can be removed from the manual page (we should not release "highly experimental code" anyway, should we??

oehharwiki2024-08-01 08:01:28

Ashok, Torsten: great work and discussion, thank you for your time!

About 5 "experimental".

I suppose, this man page was originally writen by Donal Fellows and he is on the MAC platform. In the mean time, it was tested on all supported platforms. Android is not a supported platform.

So, I just would remove the phrase.

We can also not predict,in which circumstances it works. Also, executables are nowdays often digitally signed, which puts additional data at the end, and the unpack mechanism must know about this.

The documentation should say, what it should do, anything else is a bug. And I see no reason not to say, that this command works in general.

If there are restrictions in the future, they can be added later.

Torsten, it would be great if you could just edit the man page following this discussion.

Thank you all, Harald

griffinmarkdown2024-08-02 03:21:44

WRT zipfs mkimg:

The empty string can be used for the strip and password arguments. This is how to, essentially, not provide the argument(s). However, it's much easier to get things correct if the strip value is always given. Otherwise, the possibility of getting it wrong increases.

The mkimg command is just a replacement for running zip + cat. That's pretty much all it does (but more efficiently.)

As for testing, make sure to test using Windows style path names for the strip argument.

tbergmarkdown2024-08-02 21:27:06

OK, so I will do the following (in the main branch, in a few days) if no other objections or consideration are coming:

  1. In the documentation, remove the package require ... line.

  2. In the C source code in zipfs.c, remove the Tcl_PkgProvide call.

  3. In the documentation, remove the actual string mentioned for the root mount point and refer to the subcommand zipfs root for retrieving the correct root mount point

  4. In the documentation, make clear how the behaviour is when specifying optional parameters as empty strings

  5. In the documentation, remove the remark on the code being experimental. Also, I will try and add some basic tests for zipfs mkimg in zipfs.test

tbergmarkdown2024-08-03 06:16:40

Started a branch zipfs-consolidation now to work on the tickets related to zipfs: zipfs-tickets

tbergmarkdown2024-08-05 22:25:06

After some more discussion with TCT members, the conclusion is to:

  1. Remove the package requirement.

  2. Remove the package declaration.

  3. Remove the explicit literal string for the mount point and document that [zipfs root] should be used to retrieve the actual string.

  4. Leave the syntax as it is and mention how to use empty strings for "missing" options. In future (after Tcl 9.0), another TIP might be issued proposing to use real options like this: "zipfs mkimg outfile indir ?-strip prefix? ?-password password? ?-infile fileName?". Similar syntax should then be implemented for the other subcommands as well. The fact that the current syntax is potentially not stable, will be mentioned in the manual page.

  5. The statement on experimental code will be removed.

These changes are now implemented with commit f6bfd7c52a

tberg Closed ticket [b9f3ff8fe6]. [History diff]2024-09-10 12:15:06
Log in (anonymous is fine) to add a comment.