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

2013-09-16 Thread Andrew Ross
I'm seeing this in a package I'm working on now. Is there a timeframe 
for the fix to be released? I see it's been solved in the git 
repository, but presumably testing is currently taking place before a 
release?


Thanks,
Andy

__
This is the maintainer address of Debian's Java team
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-maintainers. 
Please use
debian-j...@lists.debian.org for discussions and questions.


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

2012-10-06 Thread Francesco Poli (wintermute)
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  debhelper9.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


jh_repack-fix_rmdir.diff.gz
Description: GNU Zip compressed data
__
This is the maintainer address of Debian's Java team
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-maintainers. 
Please use
debian-j...@lists.debian.org for discussions and questions.