pombreda / libarchive

Automatically exported from code.google.com/p/libarchive
Other
0 stars 0 forks source link

symlink support/emulation/fallback on Windows #259

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I'd like to have some kind of support for symlinks on windows. I'll probably be 
writing the code myself in the coming days but first, I'd like to discuss how 
to approach the problem.

On windows, symlinks can only be created by users with admin rights. That means 
that they're most often going to be unusable from libarchive and a fallback is 
therefore needed.

Hardlinks could do the trick to some extent but, quoting 
http://blogs.msdn.com/b/b8/archive/2012/01/16/building-the-next-generation-file-
system-for-windows-refs.aspx :
  "The NTFS features we have chosen to not support in ReFS are: named streams, object IDs, short names, compression, file level encryption (EFS), user data transactions, sparse, hard-links, extended attributes, and quotas."
ReFS is coming in Windows 8 enterprise/server editions, as some kind of test, 
and actually can't be booted from. It's not there and not widespread yet, but 
it's definitely coming.

Apparently, junction points will still exist and they could maybe used but 
they're not perfect either I think.

As far as I'm concerned, I'd try to create regular symlinks if running as admin 
and otherwise, create a copy of the file, and not try any middle-ground (at 
least for now).

Are there any comments about this? Also, if not running as admin and there is a 
symlink pointing to a file outside of the archive, should that file be copied?

Original issue reported on code.google.com by Camarade...@gmail.com on 28 Apr 2012 at 10:23

GoogleCodeExporter commented 9 years ago
There are two problems:

First, how to put Windows filesystem objects into an archive?  Last I checked, 
there were several different variations of "link" on Windows filesystems with 
varying semantics across different versions of Windows.  Whether one or all of 
these should be archived as a "symlink" is an open question.  (Fortunately, the 
pax format provides a way to carry additional information, so we might be able 
to archive different things as "symlink" with an additional property to 
indicate what type of link it really was originally.)  It would be interesting 
to see if any Windows-specific archivers (such as Microsoft's CAB tools or 
PKZIP) do anything interesting here.

Second, how should "symlinks" in a tar archive be restored onto Windows?  The 
Cygwin folks have been wrestling with this problem for years and have come up 
with some workable answers.

Original comment by kientzle@gmail.com on 28 Apr 2012 at 11:42

GoogleCodeExporter commented 9 years ago
Tim,

Whatever approach is taken in regards to symlinks, one must be chosen. This 
issue in libarchive is breaking some very popular downloads, e. g. OpenSSL.

I think taking the same approach as 7-zip is one possible and savvy choice. At 
least, it works and the code is already there.

Original comment by pgqui...@elpauer.org on 3 Jul 2013 at 1:35

GoogleCodeExporter commented 9 years ago
Sounds like you know more about this than I do.  (It's been a long time
since I did significant work with Windows.)

Please take a look at libarchive/archive_read_disk_windows.c and 
libarchive/archive_write_disk_windows.c and see if you can help us
figure out how to improve this.

Original comment by kientzle@gmail.com on 4 Jul 2013 at 2:19