The Zip archive format allows absolute pathnames (i.e. those starting with '/'). Most people don't use them, but it's generally possible to do so (possibly inadvertently).
My ArchiveViewer allows extraction of all the files in an archive (which may have a mixture of absolute and relative names) into a particular directory. The obvious way to handle this is also a potentially dangerous one: use the given directory as the root for the relative files, but extract the absolute ones to their desired path. i.e., if you have an archive with the files (trailing / denotes a directory):
/a/ /a/b c/d/ c/d/e
and extracted to /tmp, you would get:
/a/ /a/b /tmp/c/d/ /tmp/c/d/e
Under Unix and some Windows NT systems, file permissions may protect files you don't own from being clobbered.
The other obvious way to handle the problem is to make all files relative whether or not they started out that way in the archive, so we'd extract the above as:
/tmp/a/ /tmp/a/b /tmp/c/d/ /tmp/c/d/e
If you wanted to extract to the root, of course, that's up to you and your filesystem security.
I'm leaning toward the second strategy; does anyone have a preference on this that they'd like to share?
Ned Konz wrote:
The Zip archive format allows absolute pathnames (i.e. those starting with '/'). Most people don't use them, but it's generally possible to do so (possibly inadvertently).
My ArchiveViewer allows extraction of all the files in an archive (which may have a mixture of absolute and relative names) into a particular directory. The obvious way to handle this is also a potentially dangerous one: use the given directory as the root for the relative files, but extract the absolute ones to their desired path. i.e., if you have an archive with the files (trailing / denotes a directory):
/a/ /a/b c/d/ c/d/e
and extracted to /tmp, you would get:
/a/ /a/b /tmp/c/d/ /tmp/c/d/e
Under Unix and some Windows NT systems, file permissions may protect files you don't own from being clobbered.
The other obvious way to handle the problem is to make all files relative whether or not they started out that way in the archive, so we'd extract the above as:
/tmp/a/ /tmp/a/b /tmp/c/d/ /tmp/c/d/e
If you wanted to extract to the root, of course, that's up to you and your filesystem security.
I'm leaning toward the second strategy; does anyone have a preference on this that they'd like to share?
I personally like the non intrusive expansion so I see which files folders etc that are involved, and from there move the files manually to where they are expected to be.
And to answer the other question you had: Will not the MacFileDirectory take care of most of those issues with file names and path names. At least one would whish it did:-)
Karl
On Thursday 27 September 2001 11:28 pm, Karl Ramberg wrote:
I personally like the non intrusive expansion so I see which files folders etc that are involved, and from there move the files manually to where they are expected to be.
Which one is non-intrusive? All I'm doing (at worst) is removing leading slashes to make everything relative.
And to answer the other question you had: Will not the MacFileDirectory take care of most of those issues with file names and path names. At least one would whish it did:-)
At least the translation of '/' to ':' has to be done outside of MacFileDirectory (actually, I use pathNameSeparator).
Ned Konz wrote:
On Thursday 27 September 2001 11:28 pm, Karl Ramberg wrote:
I personally like the non intrusive expansion so I see which files folders etc that are involved, and from there move the files manually to where they are expected to be.
Which one is non-intrusive? All I'm doing (at worst) is removing leading slashes to make everything relative.
Sorry, I ment relative.
With absolute paths stuff ends up in places hard to find them. When/if a absolute path is used it should make a text document wich tells what's been installed and where.
Karl
Ned,
I also prefer the second strategy you proposed:
/tmp/a/ /tmp/a/b /tmp/c/d/ /tmp/c/d/e
I normally do not want extracted items to go to different folders but to one folder, which I want to specify during the extract operation. Otherwise it is easy to loose track of the files.
Bernhard ----- Original Message ----- From: Ned Konz ned@bike-nomad.com To: squeak-dev@lists.squeakfoundation.org Sent: Friday, September 28, 2001 3:05 AM Subject: Desired Archive behavior w/r/t absolute paths?
The Zip archive format allows absolute pathnames (i.e. those starting with '/'). Most people don't use them, but it's generally possible to do so (possibly inadvertently).
My ArchiveViewer allows extraction of all the files in an archive (which
may
have a mixture of absolute and relative names) into a particular
directory.
The obvious way to handle this is also a potentially dangerous one: use
the
given directory as the root for the relative files, but extract the
absolute
ones to their desired path. i.e., if you have an archive with the files (trailing / denotes a directory):
/a/ /a/b c/d/ c/d/e
and extracted to /tmp, you would get:
/a/ /a/b /tmp/c/d/ /tmp/c/d/e
Under Unix and some Windows NT systems, file permissions may protect files you don't own from being clobbered.
The other obvious way to handle the problem is to make all files relative whether or not they started out that way in the archive, so we'd extract
the
above as:
/tmp/a/ /tmp/a/b /tmp/c/d/ /tmp/c/d/e
If you wanted to extract to the root, of course, that's up to you and your filesystem security.
I'm leaning toward the second strategy; does anyone have a preference on
this
that they'd like to share?
-- Ned Konz currently: Stanwood, WA email: ned@bike-nomad.com homepage: http://bike-nomad.com
Neither alternative you present is really 'good.' I can't come up with a 'good' one either, but I think I prefer a variant on the second scheme: Rather than effectively strip off any leading slash, prepend a name that's descriptive but not likely to conflict, something like 'zip_absolute'. For your example, this would yield the extracted files
/tmp/zip_absolute/a/ /tmp/zip_absolute/a/b /tmp/c/d/ /tmp/c/d/e
My reasoning is that this makes it easier to put those files where you want them. Scattering them throughout the file system, as could happen if the absolute paths were honored, makes that difficult. Mixing the absolute files in with the relative ones in the same directory structure also could make a jumble that's hard to unravel if that's not where you wanted them. With a 'zip_absolute' directory it's not too hard to move all the files within that hierarchy to achieve the results of either of the other two schemes, or to put them somewhere else entirely.
-Martin
At 6:05 PM -0700 9/27/01, Ned Konz wrote:
The Zip archive format allows absolute pathnames (i.e. those starting with '/'). Most people don't use them, but it's generally possible to do so (possibly inadvertently).
My ArchiveViewer allows extraction of all the files in an archive (which may have a mixture of absolute and relative names) into a particular directory. The obvious way to handle this is also a potentially dangerous one: use the given directory as the root for the relative files, but extract the absolute ones to their desired path. i.e., if you have an archive with the files (trailing / denotes a directory):
/a/ /a/b c/d/ c/d/e
and extracted to /tmp, you would get:
/a/ /a/b /tmp/c/d/ /tmp/c/d/e
Under Unix and some Windows NT systems, file permissions may protect files you don't own from being clobbered.
The other obvious way to handle the problem is to make all files relative whether or not they started out that way in the archive, so we'd extract the above as:
/tmp/a/ /tmp/a/b /tmp/c/d/ /tmp/c/d/e
If you wanted to extract to the root, of course, that's up to you and your filesystem security.
I'm leaning toward the second strategy; does anyone have a preference on this that they'd like to share?
-- Ned Konz currently: Stanwood, WA email: ned@bike-nomad.com homepage: http://bike-nomad.com
squeak-dev@lists.squeakfoundation.org