Bug#689788: jh_repack: exits with rmdir errors (in certain conditions) and fails to repack

Francesco Poli (wintermute) invernomuto at paranoici.org
Sat Oct 6 10:59:40 UTC 2012


Package: javahelper
Version: 0.43
Severity: normal
Tags: patch

Hello,
I am trying to use jh_repack, but it fails to work on the case I have
at hand.


Steps to reproduce the bug:

  0) download irclib-1.10.tar.gz from http://moepii.sourceforge.net/

  1) rename it:

       $ mv -i irclib-1.10.tar.gz libirclib_1.10.orig.tar.gz

  2) run jh_repack on it:

       $ jh_repack --upstream-version 1.10 libirclib_1.10.orig.tar.gz
       rmdir: failed to remove `javadoc/.svn/tmp': No such file or directory
       rmdir: failed to remove `src/.svn/tmp': No such file or directory
       rmdir: failed to remove `src/org/schwering/irc/lib/ssl/.svn/tmp': No such file or directory
       rmdir: failed to remove `src/org/schwering/irc/lib/.svn/tmp': No such file or directory
       rmdir: failed to remove `src/org/schwering/irc/.svn/tmp': No such file or directory
       rmdir: failed to remove `src/org/schwering/.svn/tmp': No such file or directory
       rmdir: failed to remove `src/org/.svn/tmp': No such file or directory
       $ echo $?
       123
       $ du --si -s /tmp/tmp.*
       701k    /tmp/tmp.gYqrH3TEjT

As can be seen, the tar archive was not repacked and the temporary directory
was not removed.


I think I found the cause of the issue.

Line 69 of jh_repack is:

  find * -depth -type d -print0 | xargs -0 rmdir -p --ignore-fail-on-non-empty

The find command prints all the directories in depth-first ordering,
as in

  [...]
  dir/subdir1
  dir/subdir2/subsub
  dir/subdir2
  dir/subdir0
  dir
  [...]

The "rmdir -p --ignore-fail-on-non-empty" attempts to remove any empty
directory and also all of its empty ancestors afterwards.
Hence, if dir/subdir2/ only contains subsub/ , and the latter is empty,
then line 69 of jh_repack first removes dir/subdir2/subsub/ , then also
removes dir/subdir2/ .
The rmdir command is then asked to remove dir/subdir2/ (if empty),
but dir/subdir2/ no longer exists *at that point* !

The attached trivial patch fixes for the bug for me.

Please apply my patch, if you agree with the reasoning and with the
proposed solution.

Thanks for your time!


Legal details: my patch is so trivial, that I think it is not copyrighted.
Hence, no license from me should be needed in order to incorporate the
fix into the package. In case this turns out to be wrong, please consider
my patch released under the terms of the GNU GPL version 2, as the rest
of javahelper.




-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (800, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages javahelper depends on:
ii  bsdmainutils         9.0.3
ii  dctrl-tools          2.22.2
ii  debhelper            9.20120909
ii  devscripts           2.12.4
ii  dpkg-dev             1.16.8
ii  libarchive-zip-perl  1.30-6

javahelper recommends no packages.

Versions of packages javahelper suggests:
pn  cvs       <none>
ii  gawk      1:4.0.1+dfsg-2
ii  tofrodos  1.7.9.debian.1-1

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jh_repack-fix_rmdir.diff.gz
Type: application/x-gzip
Size: 280 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-java-maintainers/attachments/20121006/6436eb14/attachment.bin>


More information about the pkg-java-maintainers mailing list