<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>182628</bug_id>
          
          <creation_ts>2007-06-20 01:27 0000</creation_ts>
          <short_desc>app-arch/torrentzip changes permissions and fails to run</short_desc>
          <delta_ts>2007-07-23 13:48:42 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Applications</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>gentoo@altkai.ml1.net</reporter>
          <assigned_to>net-p2p@gentoo.org</assigned_to>
          <cc>jadamcze@utas.edu.au</cc>

      

      
          <long_desc isprivate="0">
            <who>gentoo@altkai.ml1.net</who>
            <bug_when>2007-06-20 01:27:29 0000</bug_when>
            <thetext>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&apos;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&amp;aid=1415549&amp;group_id=135285&amp;atid=732451

and:

File permissions on Linux have different names: rename all
instances of &apos;S_ISTXT&apos; in the patch to &apos;S_ISVTX&apos; 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, &quot;.zip\0&quot;))
           {
-            chmod (direntp-&gt;d_name, S_IRUSR);
+            chmod (direntp-&gt;d_name, istat.st_mode | S_ISTXT);
           }
         }
         // Zip file is actually a dir
@@ -780,9 +780,9 @@
           sprintf (szTmpBuf, &quot;%s&quot;, direntp-&gt;d_name);
           strlwr (szTmpBuf);
   
-          if (strstr (szTmpBuf, &quot;.zip\0&quot;) &amp;&amp; !(istat.st_mode &amp; S_IWUSR))
+          if (strstr (szTmpBuf, &quot;.zip\0&quot;) &amp;&amp; (istat.st_mode &amp; S_ISTXT))
           {            
-            chmod (direntp-&gt;d_name, S_IWUSR);
+            chmod (direntp-&gt;d_name, istat.st_mode &amp; ~S_ISTXT);
             mig.cEncounteredZips++;
   
             if (!mig.fProcessLog)


Reproducible: Always</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jadamcze@utas.edu.au</who>
            <bug_when>2007-06-27 10:43:12 0000</bug_when>
            <thetext>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, &quot;%s&quot;, direntp-&gt;d_name);
           strlwr (szTmpBuf);

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

             if (!mig.fProcessLog)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>gentoo@altkai.ml1.net</who>
            <bug_when>2007-06-27 20:17:01 0000</bug_when>
            <thetext>Thank you, that seems to do the trick! I&apos;ll continue testing.

The patch that applies neatly is:

--- src/trrntzip.c
+++ src/trrntzip.c
@@ -782,7 +782,7 @@
   
           if (strstr (szTmpBuf, &quot;.zip\0&quot;) &amp;&amp; !(istat.st_mode &amp; S_IWUSR))
           {            
-            chmod (direntp-&gt;d_name, S_IWUSR);
+            chmod (direntp-&gt;d_name, S_IWUSR | S_IRUSR);
             mig.cEncounteredZips++;
   
             if (!mig.fProcessLog)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>armin76@gentoo.org</who>
            <bug_when>2007-07-23 13:48:42 0000</bug_when>
            <thetext>Fixed, thanks</thetext>
          </long_desc>
      
    </bug>

</bugzilla>