<?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>144624</bug_id>
          
          <creation_ts>2006-08-21 04:24 0000</creation_ts>
          <short_desc>stabilize sys-apps/file-4.18 (WAS: net-dialup/fcdsl-2.6.37 fails to unpack rpm)</short_desc>
          <delta_ts>2007-02-07 04:38:39 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>2006.0</version>
          <rep_platform>All</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>
          
          <blocked>157946</blocked>
          
          <everconfirmed>1</everconfirmed>
          <reporter>alanh@fairlite.co.uk</reporter>
          <assigned_to>alpha@gentoo.org</assigned_to>
          <cc>philantrop@gentoo.org</cc>

      

      
          <long_desc isprivate="0">
            <who>alanh@fairlite.co.uk</who>
            <bug_when>2006-08-21 04:24:34 0000</bug_when>
            <thetext>emerging fcdsl fails, as it appears to be trying to unpack a gzip archive rather than the downloaded rpm file.

emerge fcdsl

Calculating dependencies... done!
&gt;&gt;&gt; Emerging (1 of 1) net-dialup/fcdsl-2.6.37 to /
&gt;&gt;&gt; checking ebuild checksums ;-)
&gt;&gt;&gt; checking auxfile checksums ;-)
&gt;&gt;&gt; checking miscfile checksums ;-)
&gt;&gt;&gt; checking km_fcdsl-2.6-37.i586.rpm ;-)
&gt;&gt;&gt; checking avm_fcdsl-2.6-37.i586.rpm ;-)
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found sources for kernel version:
 *     2.6.16-hardened-r11
 * Checking for suitable kernel configuration options...                  [ ok ] *
 * You can control the modules which are built with the variable
 * FCDSL_CARDS which should contain a blank separated list
 * of a selection from the following cards:
 *    fcdsl2 fcdslsl fcdslusb fcdslslusb fcdslusb2 fcdsl fcdslusba
&gt;&gt;&gt; Unpacking source...

gzip: stdin: not in gzip format
cpio: premature end of archive

!!! ERROR: net-dialup/fcdsl-2.6.37 failed.
Call stack:
  ebuild.sh, line 1539:   Called dyn_unpack
  ebuild.sh, line 711:   Called src_unpack
  fcdsl-2.6.37.ebuild, line 71:   Called die

!!! failed to unpack avm_fcdsl-2.6-37.i586.rpm file
!!! If you need support, post the topmost build error, and the call stack if relevant.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>genstef@gentoo.org</who>
            <bug_when>2006-08-21 05:10:55 0000</bug_when>
            <thetext>this bug is known to us. on repetitive runs it fails sometimes and sometimes not. If you have any idea of how to fix it please help.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>alanh@fairlite.co.uk</who>
            <bug_when>2006-08-21 06:29:26 0000</bug_when>
            <thetext>Well,

this is the output from a debug run, and it shows that the &apos;dd .. | file -&apos; command is failing to detect it&apos;s a bzip2 file for some reason.

Maybe this should be assigned to the portage people as it&apos;s relying on the rpm_unpack command to get things right.

+ src_unpack
+ local rpm_archive
+ for rpm_archive in &apos;${A}&apos;
+ rpm_unpack /var/tmp/portage/fcdsl-2.6.37/distdir/km_fcdsl-2.6-37.i586.rpm
+ local rpmfile rpmoff decompcmd
+ rpmfile=/var/tmp/portage/fcdsl-2.6.37/distdir/km_fcdsl-2.6-37.i586.rpm
+ &apos;[&apos; -z /var/tmp/portage/fcdsl-2.6.37/distdir/km_fcdsl-2.6-37.i586.rpm &apos;]&apos;
+ &apos;[&apos; -x /usr/bin/rpm2cpio -a -z &apos;&apos; &apos;]&apos;
++ rpmoffset
+ rpmoff=19719
+ &apos;[&apos; -z 19719 &apos;]&apos;
+ decompcmd=&apos;gzip -dc&apos;
++ dd if=/var/tmp/portage/fcdsl-2.6.37/distdir/km_fcdsl-2.6-37.i586.rpm skip=19719 bs=1 count=3
++ file -
++ grep bzip2
+ &apos;[&apos; -n &apos;/dev/stdin: bzip2 compressed data&apos; &apos;]&apos;
+ decompcmd=&apos;bzip2 -dc&apos;
+ dd ibs=19719 skip=1 if=/var/tmp/portage/fcdsl-2.6.37/distdir/km_fcdsl-2.6-37.i586.rpm
+ bzip2 -dc
+ cpio -idmu --no-preserve-owner --quiet
+ return 0
+ for rpm_archive in &apos;${A}&apos;
+ rpm_unpack /var/tmp/portage/fcdsl-2.6.37/distdir/avm_fcdsl-2.6-37.i586.rpm
+ local rpmfile rpmoff decompcmd
+ rpmfile=/var/tmp/portage/fcdsl-2.6.37/distdir/avm_fcdsl-2.6-37.i586.rpm
+ &apos;[&apos; -z /var/tmp/portage/fcdsl-2.6.37/distdir/avm_fcdsl-2.6-37.i586.rpm &apos;]&apos;
+ &apos;[&apos; -x /usr/bin/rpm2cpio -a -z &apos;&apos; &apos;]&apos;
++ rpmoffset
+ rpmoff=7083
+ &apos;[&apos; -z 7083 &apos;]&apos;
+ decompcmd=&apos;gzip -dc&apos;
++ dd if=/var/tmp/portage/fcdsl-2.6.37/distdir/avm_fcdsl-2.6-37.i586.rpm skip=7083 bs=1 count=3
++ file -
++ grep bzip2
+ &apos;[&apos; -n &apos;&apos; &apos;]&apos;
+ dd ibs=7083 skip=1 if=/var/tmp/portage/fcdsl-2.6.37/distdir/avm_fcdsl-2.6-37.i586.rpm
+ gzip -dc
+ cpio -idmu --no-preserve-owner --quiet

gzip: stdin: not in gzip format
cpio: premature end of archive
+ return 1
+ diefunc src_unpack 71 1 &apos;failed to unpack avm_fcdsl-2.6-37.i586.rpm file&apos;
+ local funcname=src_unpack lineno=71 exitcode=1
+ shift 3
+ echo

+ echo &apos;!!! ERROR: net-dialup/fcdsl-2.6.37 failed.&apos;
!!! ERROR: net-dialup/fcdsl-2.6.37 failed.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>genstef@gentoo.org</who>
            <bug_when>2006-08-21 11:02:30 0000</bug_when>
            <thetext>liquid: have you seen this failure with rpm before and any idea how to fix it?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>philantrop@gentoo.org</who>
            <bug_when>2006-08-22 01:02:29 0000</bug_when>
            <thetext>(In reply to comment #1)
&gt; this bug is known to us. on repetitive runs it fails sometimes and sometimes
&gt; not. If you have any idea of how to fix it please help.

I don&apos;t have a clean solution I&apos;m afraid but it seems it&apos;s an issue with piping dd&apos;s output directly to &quot;file&quot;. The following test case which is near to what rpm.eclass does sooner or later causes the error, too:

export verbose=true
for (( x=0 ; x&lt;=1000; x++ )); do 
    n=`dd if=/usr/portage/distfiles/avm_fcdsl-2.6-37.i586.rpm skip=7083 bs=1 count=3 2&gt;/dev/null | file -`;
    if [ -n &quot;`echo ${n} | grep bzip2`&quot; ]; then 
        if $verbose; then 
            echo -n &quot;${x}:&quot;; echo ${n}; 
        else 
            true; 
        fi; 
    else 
        echo -n &quot;FAILURE at ${x}: &quot;; echo ${n}; 
        break; 
    fi; 
done   

This is the error I get and it&apos;s always the same (not the same iteration, of course):

FAILURE at 479: /dev/stdin: very short file (no magic)

If I pipe dd&apos;s output to a file, though, and pipe its contents to file, the error never occurs (tested several times with 10000 iterations):

n=`dd if=/usr/portage/distfiles/avm_fcdsl-2.6-37.i586.rpm skip=7083 bs=1 count=3 2&gt;/dev/null &gt;dd_out; cat dd_out | file -`;

I&apos;m currently doing repetitive &quot;rm -rf /var/tmp/...; ebuild ... unpack&quot;s with the following modification in rpm.eclass:

if [ -n &quot;`dd if=${rpmfile} skip=${rpmoff} bs=1 count=3 2&gt;/dev/null &gt; ${WORKDIR}/dd_out; cat ${WORKDIR}/dd_out | file - | grep bzip2`&quot; ];

So far, 75 out of 1000 iterations done, the error didn&apos;t occur. I&apos;m aware that this is ugly but maybe it helps to track down the problem.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>philantrop@gentoo.org</who>
            <bug_when>2006-08-22 04:58:46 0000</bug_when>
            <thetext>(In reply to comment #4)
&gt; If I pipe dd&apos;s output to a file, though, and pipe its contents to file, the
&gt; error never occurs (tested several times with 10000 iterations):
[...]
&gt; So far, 75 out of 1000 iterations done, the error didn&apos;t occur. 

With the rpm.eclass modification I described, I&apos;ve now successfully unpacked 1000 times. This definitely doesn&apos;t explain why this error occurs and it doesn&apos;t prove it won&apos;t happen again even with my changed rpm.eclass but empirically it seems to be reliable at least:

1000
 * km_fcdsl-2.6-37.i586.rpm MD5 ;-) ...                                                                         [ ok ]
 * km_fcdsl-2.6-37.i586.rpm size ;-) ...                                                                        [ ok ]
[...]
 * Converting &apos;drdsl.ini&apos; to UTF-8
&gt;&gt;&gt; Source unpacked.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2006-09-09 09:07:15 0000</bug_when>
            <thetext>Reassigned to rpm.eclass maintainer.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2006-10-14 00:49:54 0000</bug_when>
            <thetext>Oddly enough, I cannot reproduce this anymore.
Please try to reproduce it on a fully updated system.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2006-10-16 11:01:56 0000</bug_when>
            <thetext>Since genstef cannot reproduce it either, I close this as FIXED.
I think the last gzip update (app-arch/gzip-1.3.5-r9) fixed this problem.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>alanh@fairlite.co.uk</who>
            <bug_when>2006-12-07 09:13:00 0000</bug_when>
            <thetext>I&apos;ve just re-tried this today and it still happens here with a fresh portage tree and a complete rebuild. So reopening.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>alanh@fairlite.co.uk</who>
            <bug_when>2006-12-07 09:27:45 0000</bug_when>
            <thetext>It&apos;s easy to reproduce too. As in comment #4 just keep doing this...

dd if=avm_fcdsl-2.6-37.i586.rpm skip=7083 bs=1 count=3 | file -

and there&apos;ll be some failures. You&apos;ll either get this....

dd if=avm_fcdsl-2.6-37.i586.rpm skip=7083 bs=1 count=3 | file -
3+0 records in
3+0 records out
3 bytes (3 B) copied, 8.1e-05 s, 37.0 kB/s
/dev/stdin: bzip compressed data

Which is correct, or this....

dd if=avm_fcdsl-2.6-37.i586.rpm skip=7083 bs=1 count=3 | file -
/dev/stdin: very short file (no magic)
3+0 records in
3+0 records out
3 bytes (3 B) copied, 8.1e-05 s, 37.0 kB/s

which is busted.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>alanh@fairlite.co.uk</who>
            <bug_when>2006-12-07 09:31:25 0000</bug_when>
            <thetext>Just for informational purposes, here&apos;s the versions of dd and file I&apos;ve got...

dd --version
dd (coreutils) 6.4
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License &lt;http://www.gnu.org/licenses/gpl.html&gt;.
There is NO WARRANTY, to the extent permitted by law.

Written by Paul Rubin, David MacKenzie, and Stuart Kemp.

# file --version
file-4.17
magic file from /usr/share/misc/file/magic
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2006-12-11 09:37:40 0000</bug_when>
            <thetext>I cannot reproduce it with neither of the following commands:
1) dd if=/usr/portage/distfiles/avm_fcdsl-2.6-37.i586.rpm skip=7083 bs=1 count=3 | file -
2) ebuild fcdsl-2.6.37.ebuild clean unpack

I&apos;ve executed both commands several times with the same result: total success.
I have coreutils-6.4.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>philantrop@gentoo.org</who>
            <bug_when>2006-12-11 09:53:18 0000</bug_when>
            <thetext>Using my test case from comment #4 and setting it to 1000, 10000, 15000 and finally 50000 iterations I haven&apos;t experienced a single failure either.

sys-apps/coreutils-6.7 (acl nls -selinux -static) which includes dd 6.7 and file 4.18.

I&apos;m going to start another test run on an up-to-date stable system in a few minutes. </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>philantrop@gentoo.org</who>
            <bug_when>2006-12-11 14:22:39 0000</bug_when>
            <thetext>(In reply to comment #12)
&gt; I&apos;ve executed both commands several times with the same result: total success.
&gt; I have coreutils-6.4.

Using my test case from comment #4 I *can* definitely reproduce this on a current stable system within 1000 iterations. 

Looks like &lt;=file-4.17-r1 (not coreutils&apos; dd) causes this problem because I can reproduce the problem when downgrading (on an unstable system) from 4.18. After upgrading again the problem is gone.

On a stable system upgrading to 4.18 but keeping coreutils-6.4 seems to fix the problem, too. (The long-term tests are still running but no errors during the first 1000 iterations.)

I predict some boredom on my part tomorrow which I might prevent by comparing the sources. :-)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>philantrop@gentoo.org</who>
            <bug_when>2006-12-12 11:10:09 0000</bug_when>
            <thetext>Ok, file&apos;s upstream, Christos Zoulas, has kindly confirmed that this problem is caused by a bug in file 4.17:

[Answering my inquiry if he was aware of this problem]
&quot;Yes, the problem was that sometimes file would not wait long enough
for input to appear and would exit too soon.&quot;

Time to stabilise 4.18?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>genstef@gentoo.org</who>
            <bug_when>2006-12-12 12:53:08 0000</bug_when>
            <thetext>base-system issue. They need to CC the arches for stabling</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vapier@gentoo.org</who>
            <bug_when>2006-12-12 19:49:24 0000</bug_when>
            <thetext>*** Bug 157946 has been marked as a duplicate of this bug. ***</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>fauli@gentoo.org</who>
            <bug_when>2006-12-12 23:16:31 0000</bug_when>
            <thetext>x86 filed</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>fmccor@gentoo.org</who>
            <bug_when>2006-12-13 04:20:49 0000</bug_when>
            <thetext>Also is sparc.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>dertobi123@gentoo.org</who>
            <bug_when>2006-12-13 08:07:30 0000</bug_when>
            <thetext>ppc stable</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ranger@gentoo.org</who>
            <bug_when>2006-12-13 17:53:29 0000</bug_when>
            <thetext>ppc64 stable</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jer@gentoo.org</who>
            <bug_when>2006-12-13 18:19:51 0000</bug_when>
            <thetext>Stable for HPPA.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>welp@gentoo.org</who>
            <bug_when>2006-12-14 13:08:06 0000</bug_when>
            <thetext>AMD64 gone ;)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ahf@0x90.dk</who>
            <bug_when>2006-12-22 12:11:26 0000</bug_when>
            <thetext>Stable on MIPS.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vapier@gentoo.org</who>
            <bug_when>2007-02-07 04:38:39 0000</bug_when>
            <thetext>all set</thetext>
          </long_desc>
      
    </bug>

</bugzilla>