Bug#997951: jsvn wrapper shell script does not work at all

2021-11-21 Thread tony mancill
On Sun, Oct 31, 2021 at 07:49:03PM -0700, tony mancill wrote:
> On Thu, Oct 28, 2021 at 09:07:45PM -0700, tony mancill wrote:
> > On Wed, Oct 27, 2021 at 03:55:11PM +0100, Simon Tatham wrote:
> > > Package: svnkit
> > > Version: 1.8.14-4
> > > 
> > > If I install svnkit and try to use the 'jsvn' command-line interface, I
> > > see mysterious error messages, one of which bizarrely involves Cygwin:
> 
> I plan to address this with the upload of 1.10.3.

I opted for the initial upload of 1.10.3 to use the existing build
system and will address this in a subsequent Debian revision.


signature.asc
Description: PGP signature


Bug#997951: jsvn wrapper shell script does not work at all

2021-10-31 Thread tony mancill
On Thu, Oct 28, 2021 at 09:07:45PM -0700, tony mancill wrote:
> On Wed, Oct 27, 2021 at 03:55:11PM +0100, Simon Tatham wrote:
> > Package: svnkit
> > Version: 1.8.14-4
> > 
> > If I install svnkit and try to use the 'jsvn' command-line interface, I
> > see mysterious error messages, one of which bizarrely involves Cygwin:
> 
> Hi Simon,
> 
> Thank you for reporting this bug.  That definitely does look like a
> templating issue.  I assume this hasn't been reported before because the
> primary use of the svnkit within Debian has been for jars in the
> libsvnkit-java library package.

I had a chance to look at this more closely.  It stems from the upstream
build system being gradle while the Debian build using ant and fails to
(fully) process the template.

I plan to address this with the upload of 1.10.3.


signature.asc
Description: PGP signature


Bug#997951: jsvn wrapper shell script does not work at all

2021-10-28 Thread tony mancill
On Wed, Oct 27, 2021 at 03:55:11PM +0100, Simon Tatham wrote:
> Package: svnkit
> Version: 1.8.14-4
> 
> If I install svnkit and try to use the 'jsvn' command-line interface, I
> see mysterious error messages, one of which bizarrely involves Cygwin:

Hi Simon,

Thank you for reporting this bug.  That definitely does look like a
templating issue.  I assume this hasn't been reported before because the
primary use of the svnkit within Debian has been for jars in the
libsvnkit-java library package.

I am in the midst of updating svnkit to version 1.10.3, which will take
a bit yet because it requires a newer libjna-java (which should be ready
soon - I'm just making sure there aren't any unexpected regressions in
its reverse build-deps).

Once that is ready, I will take a look at the scripts in svnkit binary
package too.

Cheers,
tony


signature.asc
Description: PGP signature


Bug#997951: jsvn wrapper shell script does not work at all

2021-10-27 Thread Simon Tatham
Package: svnkit
Version: 1.8.14-4

If I install svnkit and try to use the 'jsvn' command-line interface, I
see mysterious error messages, one of which bizarrely involves Cygwin:

$ jsvnadmin init test-repo
/usr/bin/jsvnadmin: 29: $cygwin: not found
Error: JAVA_HOME is not defined correctly.
  We cannot execute $JAVACMD

$ jsvn checkout svn://example.host/example/repo
/usr/bin/jsvn: 29: $cygwin: not found
Error: JAVA_HOME is not defined correctly.
  We cannot execute $JAVACMD

$ jsvnversion .
/usr/bin/jsvnversion: 29: $cygwin: not found
Error: JAVA_HOME is not defined correctly.
  We cannot execute $JAVACMD

All of these programs in /usr/bin are symlinks to the same shell script
/usr/share/svnkit/jsvn which is supposed to find and invoke the Java
interpreter on the actual svnkit class file in an appropriate manner.

But that shell script cannot possibly work, because it's completely full
of inappropriate backslashes which break all the shell syntax. For
example, the 'if' statement starting at line 29 of the script (cited in
the above error message involving $cygwin) looks like this:

if \$cygwin ; then
  [ -n "\$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "\$JAVA_HOME"`
  [ -n "\$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "\$CLASSPATH"`
fi

Further up the file, the shell variable 'cygwin' is defined to be either
'true' or 'false'. So 'if $cygwin' would expand to 'if true' or 'if
false' and do what the author expected. But 'if \$cygwin' will instead
try to run a program literally called '$cygwin' on your path, and (in
the typical case) not find one, which explains the error message above.
And the same error is visible in the code inside the 'if': the test
[ -n "\$JAVA_HOME" ] will always return success, because it's testing if
a completely literal string is non-empty.

There is just one $ sign in the whole script not preceded by a
backslash, and it's right at the bottom in the final 'exec', referring
to a shell variable 'mainclass', which is not defined or even mentioned
anywhere else in the script:

exec "\$JAVACMD" \$JAVA_OPTS \\
  "\$EXTRA_JVM_ARGUMENTS" \\
  -classpath "\$CLASSPATH" \\
  ${mainclass} \\
  "\$@"

It looks very much as if this isn't a shell script at all: it looks like
some kind of precursor or template file which should have been put
through a substitution step at build time. That substitution would have
filled in something sensible for ${mainclass}, and also removed all the
backslash-escapes from the rest of the script to turn it into valid
shell syntax. But in the Debian package build, that substitution step
(whatever it is) has been left out, so a file ends up in /usr/bin that
can't possibly do anything useful.

-- 
for k in [pow(x,37,0x1a1298d262b49c895d47f) for x in [0x50deb914257022de7fff,
0x213558f2215127d5a2d1, 0x90c99e86d08b91218630, 0x109f3d0cfbf640c0beee7,
0xc83e01379a5fbec5fdd1, 0x19d3d70a8d567e388600e, 0x534e2f6e8a4a33155123]]:
 print("".join([chr(32+3*((k>>x)&1))for x in range(79)])) #