When you use the command "darcs dist -d foo-1.0", if ${TMPDIR}/foo-1.0
already exists, you get a tarball foo-1.0.tar.gz containing a directory
foo-1.0-1, instead of the expected foo-1.0. If ${TMPDIR}/foo-1.0-1
exists you get a directory foo-1.0-2 in the tarball, and so on.

To reproduce the problem, run the script reproduce-dist-bug.sh in 
<http://www.pseudorandom.co.uk/2005/darcsdist/>. The same directory
contains expected and actual output.

Expected output: whatever-1.1.tar.gz contains 'whatever-1.1/', as in
expected.txt. Under darcs 1.0.2-1 (Debian), 1.0.3-2 (Debian) and 1.0.4rc2
(current darcs pull), whatever-1.1.tar.gz contains 'whatever-1.1-3/', as in
actual.txt.

The attached patch produces the expected output by creating a directory
$TMPDIR/darcsdist (or $TMPDIR/darcsdist-1, etc.) and creating the
exported directory inside that. I am not a Haskell programmer, so my
alteration could probably do with some refactoring from someone who
knows what they're doing.

Regards,
        Simon
New patches:

[Avoid putting a wrongly-named directory in dist tarball if the name we wanted already exists in $TMPDIR
Simon McVittie <http://www.pseudorandom.co.uk/>**20051106145821] {
hunk ./Dist.lhs 87
-   withRecorded (withTempDir dn) $ \ddir -> do
-    case predist of Nothing -> return ExitSuccess
-                    Just pd -> system pd
-    setCurrentDirectory (ddir++"/..")
-    exec "tar" ["-cf", "-", reverse $ takeWhile (/='/') $ reverse ddir]
-               "/dev/null" tarfile
-    when verb $ withTemp $ \tar_listing -> do
-                  exec "tar" ["-tf", "-"] tarfile tar_listing
-                  to <- readBinFile tar_listing
-                  putStr to
-    exec "gzip" ["-c"] tarfile (formerdir++"/"++dn++".tar.gz")
-    putStrLn $ "Created dist as "++dn++".tar.gz"
+   withTempDir "darcsdist" $ \tempdir -> do
+    setCurrentDirectory (formerdir)
+    withRecorded (withTempDir (tempdir++"/"++dn)) $ \ddir -> do
+     case predist of Nothing -> return ExitSuccess
+                     Just pd -> system pd
+     setCurrentDirectory (tempdir)
+     exec "tar" ["-cf", "-", reverse $ takeWhile (/='/') $ reverse ddir]
+                "/dev/null" tarfile
+     when verb $ withTemp $ \tar_listing -> do
+                   exec "tar" ["-tf", "-"] tarfile tar_listing
+                   to <- readBinFile tar_listing
+                   putStr to
+     exec "gzip" ["-c"] tarfile (formerdir++"/"++dn++".tar.gz")
+     putStrLn $ "Created dist as "++dn++".tar.gz"
}

Context:

[TAG 1.0.4rc2
David Roundy <[EMAIL PROTECTED]>**20051106121631] 
Patch bundle hash:
53d143568300102d0101649163001558ee052a00

Attachment: signature.asc
Description: Digital signature

_______________________________________________
darcs-devel mailing list
[email protected]
http://www.abridgegame.org/cgi-bin/mailman/listinfo/darcs-devel

Reply via email to