Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 182628 - app-arch/torrentzip changes permissions and fails to run
Summary: app-arch/torrentzip changes permissions and fails to run
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: Gentoo net-p2p team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-20 01:27 UTC by trefoil
Modified: 2007-07-23 13:48 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description trefoil 2007-06-20 01:27:29 UTC
Hello, this is a known problem upstream, where torrentzip will change permissions of the file it compresses, even locking itself out of being able to write a file.

Currently I must use wine + torrentzip, which is less than ideal. I'm not a C programmer, so would someone please look over this patch, taken from FreeBSD, and see if it fixes the problem? tyvm!

Also see: https://sourceforge.net/tracker/index.php?func=detail&aid=1415549&group_id=135285&atid=732451

and:

File permissions on Linux have different names: rename all
instances of 'S_ISTXT' in the patch to 'S_ISVTX' and
trrntzip will then compile.

--- src/trrntzip.c-orig	Mon May  2 08:38:40 2005
+++ src/trrntzip.c	Sat May  7 02:51:55 2005
@@ -716,7 +716,7 @@
   
     if (dirp)
     {
-      // First set all the files to read-only. This is so we can skip
+      // First set the sticky bit on all files. This is so we can skip
       // our new zipfiles if they are returned by readdir() a second time.
       while (direntp = readdir (dirp))
       {
@@ -732,7 +732,7 @@
   
           if (strstr (szTmpBuf, ".zip\0"))
           {
-            chmod (direntp->d_name, S_IRUSR);
+            chmod (direntp->d_name, istat.st_mode | S_ISTXT);
           }
         }
         // Zip file is actually a dir
@@ -780,9 +780,9 @@
           sprintf (szTmpBuf, "%s", direntp->d_name);
           strlwr (szTmpBuf);
   
-          if (strstr (szTmpBuf, ".zip\0") && !(istat.st_mode & S_IWUSR))
+          if (strstr (szTmpBuf, ".zip\0") && (istat.st_mode & S_ISTXT))
           {            
-            chmod (direntp->d_name, S_IWUSR);
+            chmod (direntp->d_name, istat.st_mode & ~S_ISTXT);
             mig.cEncounteredZips++;
   
             if (!mig.fProcessLog)


Reproducible: Always
Comment 1 gent_bz 2007-06-27 10:43:12 UTC
The provided patch does not compile.

Try this - it seems to work for me :

--- src/trrntzip.c-orig Mon May  2 08:38:40 2005
+++ src/trrntzip.c      Sat May  7 02:51:55 2005
@@ -780,9 +780,9 @@
           sprintf (szTmpBuf, "%s", direntp->d_name);
           strlwr (szTmpBuf);

           if (strstr (szTmpBuf, ".zip\0") && !(istat.st_mode & S_IWUSR))
           {            
-            chmod (direntp->d_name, S_IWUSR);
+            chmod (direntp->d_name, S_IWUSR | S_IRUSR);
             mig.cEncounteredZips++;

             if (!mig.fProcessLog)
Comment 2 trefoil 2007-06-27 20:17:01 UTC
Thank you, that seems to do the trick! I'll continue testing.

The patch that applies neatly is:

--- src/trrntzip.c
+++ src/trrntzip.c
@@ -782,7 +782,7 @@
   
           if (strstr (szTmpBuf, ".zip\0") && !(istat.st_mode & S_IWUSR))
           {            
-            chmod (direntp->d_name, S_IWUSR);
+            chmod (direntp->d_name, S_IWUSR | S_IRUSR);
             mig.cEncounteredZips++;
   
             if (!mig.fProcessLog)
Comment 3 Raúl Porcel (RETIRED) gentoo-dev 2007-07-23 13:48:42 UTC
Fixed, thanks