Post Script suddenly stopped working 2.2.0 Alpha1 [8483e4a]

Questions and bug reports for Beta releases should be posted here.
Forum rules
Help us help you:
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
Jumbs
Newbie
Newbie
Posts: 38
Joined: May 2nd, 2011, 4:50 pm

Post Script suddenly stopped working 2.2.0 Alpha1 [8483e4a]

Post by Jumbs »

One of my scripts started failing on the line:

Code: Select all

cd $1

Something change with the passed arguments?
User avatar
safihre
Administrator
Administrator
Posts: 5339
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Post Script suddenly stopped working 2.2.0 Alpha1 [8483

Post by safihre »

Not that I am aware off..
Could you maybe post the whole script so we can check?
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
Jumbs
Newbie
Newbie
Posts: 38
Joined: May 2nd, 2011, 4:50 pm

Re: Post Script suddenly stopped working 2.2.0 Alpha1 [8483

Post by Jumbs »

Sorry, I forgot to include the error: line 5: cd: too many arguments

It could be something else, but the timing seems to correlate with the upgrade to the alpha, and i haven't change this script in years.

Code: Select all

#!/bin/bash
#
source ~/.personal

cd $1
if [ $? -eq 1 ] ; then
	exit	
fi
touch $Logloc/log
echo $1 >> $Logloc/log
ls >> $Logloc/log
chmod -R 644 *
mv * ~/$Start
rand=$RANDOM
if [ $? -eq 1 ] ; then
	mkdir ~/$Start/MoveErrorRescue$rand
	mv * ~/$Start/MoveErrorRescue$rand
fi

cd ~/$Start
rm $Logloc/log
mv $1 ~/.local/share/Trash/files

User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Post Script suddenly stopped working 2.2.0 Alpha1 [8483

Post by sander »

Ah, then the cause is clear:

Code: Select all

$ cd /home/sander/some space/blabla/
bash: cd: too many arguments
... so a space in $1.

Can you try

Code: Select all

cd "$1"
Jumbs
Newbie
Newbie
Posts: 38
Joined: May 2nd, 2011, 4:50 pm

Re: Post Script suddenly stopped working 2.2.0 Alpha1 [8483

Post by Jumbs »

First off, i tried it on my friends who is running 2.1.0 [443efb5] and the same scripts as me. It worked fine. I even tried the exact same nzb.
So it definitely seems to be something between versions.

Thanks for the work around, i really should have thought of that.
I added quotes to all 3 references to $1 and it seems to be functional now. I will have to go through my other scripts.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Post Script suddenly stopped working 2.2.0 Alpha1 [8483

Post by sander »

From https://sabnzbd.org/wiki/scripts/post-p ... ng-scripts
Please note: Use %1 in Windows scripts and $1 in Unix scripts. In Windows the parameters will be enclosed in double quotes ("my name").
On Posix systems (macOS, Linux, Unix) the parameters will not have quotes at all.
Jumbs
Newbie
Newbie
Posts: 38
Joined: May 2nd, 2011, 4:50 pm

Re: Post Script suddenly stopped working 2.2.0 Alpha1 [8483

Post by Jumbs »

Good to know.

However it is going from working to not between versions, so you might get some complaints when it goes to release.
User avatar
safihre
Administrator
Administrator
Posts: 5339
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Post Script suddenly stopped working 2.2.0 Alpha1 [8483

Post by safihre »

The thing is that nothing has changed with respect to post processing scripts. Maybe it was some other change on your machine that happend with same upgrade?
Because as Sander describes, Linux always needs the extra quotes.
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
Jumbs
Newbie
Newbie
Posts: 38
Joined: May 2nd, 2011, 4:50 pm

Re: Post Script suddenly stopped working 2.2.0 Alpha1 [8483

Post by Jumbs »

Who knows. My friends run linux as well, same OS and everything, no issues for them in 2.1.0.
I updated all my other scripts, so all good on my end.

Thanks.
Post Reply