Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 116803 - net-p2p/azureus-bin (and probably net-p2p/azureus) wrapper script does not work with relative paths
Summary: net-p2p/azureus-bin (and probably net-p2p/azureus) wrapper script does not wo...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Petteri Räty (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on: 113389 122456
Blocks:
  Show dependency tree
 
Reported: 2005-12-26 13:16 UTC by Andreas Eriksson
Modified: 2007-02-10 21:29 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Eriksson 2005-12-26 13:16:13 UTC
Problem #1:
If you start the wrapper script /usr/bin/azureus without any arguments it complains about not being able to find a missing file. This is because the last line in the wrapper has a "$1" at the end, which makes Azureus think that someone passed a parameter even if there wasn't one passed.

Solution:
Replacing the last line with the following lines fixes the problem, it doesn't complain about a missing file if you don't have any arguments, and if you put one argument it will open that torrent:

if [ -n "$1" ]; then
    java -cp $(java-config -p systray4j,azureus-bin 2>/dev/null) -Djava.library.path="${AZDIR}" org.gudy.azureus2.ui.swt.Main "$1"
else
    java -cp $(java-config -p systray4j,azureus-bin 2>/dev/null) -Djava.library.path="${AZDIR}" org.gudy.azureus2.ui.swt.Main
fi

Problem #2:
Since it uses $1 it will only be able to open one torrent at a time, but I think azureus can handle open multiple files from the command-line, so the wrapper script should be able to handle it too.

partial solution:
Replacing "$1" with $@ passes on all the arguments of the wrapper script to azureus, but this won't work with filenames that have spaces in them since it will think that its a new file when it encounters a space. You can't just put "$@" because then it will think that all filenames is one big filename with lots of spaces in it. Maybe you could loop trought the arguments in some way and add correct parenthesis, but I'm not really sure how to tackle this.

Problem #3:
Azureus/the wrapper script can't handle relative paths for some reason, you have to specify the full path to the torrents. I don't have a solution for this.
Comment 1 Andreas Eriksson 2005-12-26 13:17:17 UTC
Seems like the line wrapping cut out my lines, the -Djava lines are supposed to be on the lines above them
Comment 2 Petteri Räty (RETIRED) gentoo-dev 2005-12-26 13:33:51 UTC
(In reply to comment #0)
> You can't just put
> "$@" because then it will think that all filenames is one big filename with
> lots of spaces in it. Maybe you could loop trought the arguments in some way
> and add correct parenthesis, but I'm not really sure how to tackle this.

Actually bash handles "${@}" specially. From man bash:
       @      Expands  to  the  positional  parameters, starting from one.  When the expansion occurs within double quotes, each parameter expands to a separate word.  That is, "$@" is
              equivalent to "$1" "$2" ...  When there are no positional parameters, "$@" and $@ expand to nothing (i.e., they are removed).

> 
> Problem #3:
> Azureus/the wrapper script can't handle relative paths for some reason, you
> have to specify the full path to the torrents. I don't have a solution for
> this.
> 

Try dev-java/azureus-2.3.0.6 which has a wrapper script that fixes problems 1 and 2. Problem three seems like an upstream issue but could be fixed by 2.3.0.6.

It will be a while before I get azureus-2.3.0.6 marked stable so I will probably have to roll out a new release of azureus-bin to get the wrapper script fixes to stable sooner but let's see.
Comment 3 Andreas Eriksson 2005-12-26 15:12:06 UTC
Thank you for educating me about the bash thing, its good to know for when scripting in the future. :)

I read that azureus-bin is being deprecated in the bug you marked that this depended upon, so I will use net-p2p/azureus in the future.

But problem 3 still remains, and its not fixed in 2.3.0.6. I know this because I was actually using 2.3.0.6 (I replaced the .jar file with the new version , worked fine). Should I report this problem to upstream?
Comment 4 Petteri Räty (RETIRED) gentoo-dev 2006-01-02 13:34:26 UTC
(In reply to comment #3)
> Thank you for educating me about the bash thing, its good to know for when
> scripting in the future. :)
> 
> I read that azureus-bin is being deprecated in the bug you marked that this
> depended upon, so I will use net-p2p/azureus in the future.
> 
> But problem 3 still remains, and its not fixed in 2.3.0.6. I know this because
> I was actually using 2.3.0.6 (I replaced the .jar file with the new version ,
> worked fine). Should I report this problem to upstream?
> 

Just tested with an upstream wrapper script and there relative paths work so this is an issue with our wrapper script.
Comment 5 Petteri Räty (RETIRED) gentoo-dev 2006-01-02 13:45:31 UTC
> 
> Just tested with an upstream wrapper script and there relative paths work so
> this is an issue with our wrapper script.
> 

We have cd ${dotazudir} in the wrapper script. It seems that azureus creates a plugins dir to the current directory if I remove this so that is not a solution. 
Comment 6 Andreas Eriksson 2006-01-04 09:34:28 UTC
how about something that saves the pwd before you cd into ${dotazudir} and then uses sed to prepend it to the paths of the torrents if the first character isn't a /?
Comment 7 Petteri Räty (RETIRED) gentoo-dev 2006-01-04 09:38:34 UTC
(In reply to comment #6)
> how about something that saves the pwd before you cd into ${dotazudir} and then
> uses sed to prepend it to the paths of the torrents if the first character
> isn't a /?
> 

How about just fixing the plugins directory creation in Azureus code?
Comment 8 Petteri Räty (RETIRED) gentoo-dev 2006-02-12 03:03:54 UTC
I think the wrapper script in 2.4.0.0 should fix your problem:
https://svn.gentooexperimental.org/svn/java/gentoo-java-experimental/net-p2p/azureus/
Comment 9 Zac Slade 2006-02-22 04:02:15 UTC
Reading the new azureus-gentoo-2.4.0.0.sh, it should fix all the issues.  If you combine that with the ebuild patch I submitted to the azureus 2.4.0.0 bug, then I think we can close this whole chain of bugs.
Comment 10 Rudo Thomas 2006-04-09 15:01:04 UTC
Hi guys,

I noticed that azureus-bin-2.4.0.2 still suffers the "$1" problem mentioned in comment #0. Could someone with write access to the portage tree fix it (to "$@", as suggested in comment #2)?

The file is net-p2p/azareus-bin/files/azureus-bin-gentoo.sh .

Thanks.
Comment 11 Josh Nichols (RETIRED) gentoo-dev 2006-07-23 14:00:51 UTC
The wrapper script mentioned by Petteri R
Comment 12 Josh Nichols (RETIRED) gentoo-dev 2006-07-23 14:00:51 UTC
The wrapper script mentioned by Petteri Räty is now in portage, with 2.4.0.2.
Comment 13 fturtle 2006-08-15 22:59:10 UTC
Here's what I consider to be the only proper solution, that solves the problem completely.

simply edit the startup script and remove the "$1" from the end of the last line and yes I've tested it and can now confirm no error message popups.
Comment 14 Nathan Caldwell 2006-08-15 23:34:30 UTC
(In reply to comment #12)
> Here's what I consider to be the only proper solution, that solves the problem
> completely.
> 
> simply edit the startup script and remove the "$1" from the end of the last
> line and yes I've tested it and can now confirm no error message popups.
> 

Actually the correct fix (using "$@") has allready been discussed (see comment #2). It looks like the wrapper script for azureus-bin still hasn't been updated, though.
Comment 15 Petteri Räty (RETIRED) gentoo-dev 2007-02-10 21:29:26 UTC
This has been fixed quite a while in 2.5* for example. I just remove azureus-bin from the tree so can mark this as fixed.