View Issue Details

IDProjectCategoryView StatusLast Update
0006395ardourbugspublic2015-10-18 09:56
ReporterHouston4444 Assigned Tox42  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version4.X git (version in description) 
Summary0006395: Linux: ardour can't launch session containing spaces
Descriptionthis file (in source code):
./Ardour-4.1.0/tools/linux_packaging/ardour.sh.in
which is usually installed as /usr/bin/ardour4
can't launch ardour sessions containing spaces as arguments.
I rewrite the script to can do this, but I wrote it in bash (I don't know how to do this with sh).
That's in attachment.

TagsNo tags attached.

Relationships

has duplicate 0005969 closedx42 ardour3 doesn't support any space character launching sessions 

Activities

2015-06-26 13:05

 

ardour4 (1,426 bytes)   
#!/bin/bash

# This is Linux-specific startup script for a bundled version of Ardour


ca=1
  while [ $# -gt 0 ]
    do
	case "$1" in
	  --debug)
	    DEBUG="T" ;;
	  *)
	    ARGS[$ca]="$1"
	    ((ca++))
	esac
      shift
    done

# LD_LIBRARY_PATH needs to be set here so that epa can swap between the original and the bundled version
# (the original one will be stored in PREBUNDLE_ENV)
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export PREBUNDLE_ENV="$(env)"

BIN_DIR=/opt/ardour4/bin
INSTALL_DIR=$(dirname $BIN_DIR)
LIB_DIR=$INSTALL_DIR/lib
ETC_DIR=$INSTALL_DIR/etc
USER_ARDOUR_DIR=$HOME/.config/ardour4

if [ ! -d $USER_ARDOUR_DIR ] ; then
    mkdir -p $USER_ARDOUR_DIR || exit 1
fi

# this triggers code in main() that will reset runtime environment variables
# to point to directories inside the ardour package

export ARDOUR_BUNDLED=true

# NSM needs a path to this script
export ARDOUR_SELF="$0"

# edited

export LXVST_PATH="$VST_PATH"
export PATH=/opt/ardour4/bin:$PATH

# Disable extra modules from being loaded by gtk (example, libcanberra-gtk-module.so)
export GTK_MODULES=""
# Set this so that the executable will find all the right libraries inside the bundle
export LD_LIBRARY_PATH=$INSTALL_DIR/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

if [ "T" = "$DEBUG" ]; then
	export ARDOUR_INSIDE_GDB=1
	exec gdb $INSTALL_DIR/bin/ardour-4.1.0
else
	exec $INSTALL_DIR/bin/ardour-4.1.0 "${ARGS[@]}"
fi
ardour4 (1,426 bytes)   

2015-09-25 09:30

 

ardour4.sh (1,241 bytes)

Houston4444

2015-09-25 09:32

reporter   ~0017346

I am sorry to see that the fact that Ardour can not directly initiate a session whose name contains spaces not care about you more than that!

Here is The Good script in sh. It works well on debug mode too. (ardour4.sh which should be renamed ardour4)

You just have to change Ardour's version number at the bottom of the script.

colinf

2015-09-25 10:59

updater   ~0017348

I can't reproduce this bug: all the following commands already work perfectly for me here, so I don't understand what problem the attached script is trying to solve.

$ ardour4 --new ~/ardour3-sessions/dir\ with\ spaces/new\ session\ with\ spaces

 - pops up the 'new session' dialogue pre-populated with the correct name (with the spaces)

$ ardour4 ~/ardour3-sessions/dir\ with\ spaces/new\ session\ with\ spaces

- re-opens that session.

$ ardour4 ~/"ardour3-sessions/dir with spaces/new session with spaces"

 - Quoting the whole session path works equally well to open the session.
 

Also, it's impossible to see what the actual changes are from just the attached file: a patch against the current source would make its intention a lot clearer.

The actual ardour4 script is generated from tools/linux-packaging/ardour.sh.in, so the patch would need to be against that file.

chaot

2015-09-25 11:04

reporter   ~0017349

I also could not reproduce this issue.

You of course have to escape the spaces but that has something to do with your shell and not with ardour. Might that be the case? So:

ardour4 my\ session

instead of

ardour4 my session

Houston4444

2015-09-25 12:12

reporter   ~0017350

On Ubuntu it simply don't works !!!
if I try to open a session with this command:

/usr/bin/ardour4 /home/user/dir\ with\ spaces/mysession\ with\ spaces

ardour pop-up says:

There is no existing session at "/home/user/dir"

Even if it works this way for you, I can't think it works if you try to open session this way:

ardour4 "/home/user/dir with spaces/mysession with spaces"

and file managers generally don't replace spaces with "\ ", it send 1 file name as 1 argument to the script. Does it works if you launch session with spaces directly from your file manager ?

I really doubt that it can works with special characters as "'|` too.

chaot

2015-09-25 13:19

reporter   ~0017351

On my Ubuntu machine it indeed also does not work. But I'm still not sure if that's a bug in Ardour or the Ubuntu terminal/shell.

Houston4444

2015-09-25 14:06

reporter   ~0017352

I don't know any other troubles with my shell. Now question is: does my sh script works perfectly on your other linux machine ?

x42

2015-09-25 14:58

administrator   ~0017353

The proposed patch (backported to ardour.sh.in) would change semantics: --debug will need to be the first option. Other than that it's fine.

I'll attach a diff here for review.

2015-09-25 14:59

 

ardour-startup.sh.diff (908 bytes)   
diff --git a/tools/linux_packaging/ardour.sh.in b/tools/linux_packaging/ardour.sh.in
index 21068da..63e228f 100644
--- a/tools/linux_packaging/ardour.sh.in
+++ b/tools/linux_packaging/ardour.sh.in
@@ -2,19 +2,11 @@
 
 # This is Linux-specific startup script for a bundled version of Ardour
 
-ARGS=""
-
-while [ $# -gt 0 ] ; do
-	case $1 in
-
-	--debug)
-		DEBUG="T";
-		shift ;;
-	*)
-		ARGS=$ARGS$1" ";
-		shift; ;;
-	esac
-done
+    case "$1" in
+        --debug )
+            DEBUG="T"
+            shift
+    esac
 
 # LD_LIBRARY_PATH needs to be set here so that epa can swap between the original and the bundled version
 # (the original one will be stored in PREBUNDLE_ENV)
@@ -48,8 +40,5 @@ if [ "T" = "$DEBUG" ]; then
 	export ARDOUR_INSIDE_GDB=1
 	exec gdb $INSTALL_DIR/bin/%EXENAME%-%VER%
 else
-	exec $INSTALL_DIR/bin/%EXENAME%-%VER% $ARGS
+	exec $INSTALL_DIR/bin/%EXENAME%-%VER% "$@"
 fi
-
-
-
ardour-startup.sh.diff (908 bytes)   

x42

2015-09-25 15:03

administrator   ~0017354

another approach would be to simply change the hashbang to #!/bin/bash
(on debian/ubuntu /bin/sh is dash which handles arguments differently)

Houston4444

2015-09-26 11:05

reporter   ~0017356

NO. I just try and changing the hashbang to bash don't make work it better.

If trouble is that --debug would need to be the first option, this new script allows to put --debug option at any position.

But, in my script as in the original, when script is launch with --debug, other options are ignored. So I can't see the goal to can put --debug anywhere.

2015-09-26 11:08

 

Houston4444

2015-09-26 11:09

reporter   ~0017357

Sorry, the new script loaded is ardour4_debuganywhere.sh .

x42

2015-10-17 00:01

administrator   ~0017476

Slightly adjusted script comes with Ardour 4.4-10-gcbea1a4

please test

Houston4444

2015-10-17 08:32

reporter   ~0017477

Humm.. How get I this version ?

x42

2015-10-17 11:22

administrator   ~0017479

The easiest way is from http://nightly.ardour.org/

It includes the relevant part from ardour4_debuganywhere.sh, see https://github.com/Ardour/ardour/commit/cbea1a4

Many thanks for your contribution.

Houston4444

2015-10-18 08:55

reporter   ~0017490

It works. Thanks.
Status can be "resolved".

Issue History

Date Modified Username Field Change
2015-06-26 13:05 Houston4444 New Issue
2015-06-26 13:05 Houston4444 File Added: ardour4
2015-09-25 09:30 Houston4444 File Added: ardour4.sh
2015-09-25 09:32 Houston4444 Note Added: 0017346
2015-09-25 10:59 colinf Note Added: 0017348
2015-09-25 11:01 colinf Relationship added has duplicate 0005969
2015-09-25 11:04 chaot Note Added: 0017349
2015-09-25 12:12 Houston4444 Note Added: 0017350
2015-09-25 13:19 chaot Note Added: 0017351
2015-09-25 13:21 chaot Status new => confirmed
2015-09-25 14:06 Houston4444 Note Added: 0017352
2015-09-25 14:58 x42 Note Added: 0017353
2015-09-25 14:58 x42 File Added: ardour-startup.sh.diff
2015-09-25 14:59 x42 File Deleted: ardour-startup.sh.diff
2015-09-25 14:59 x42 File Added: ardour-startup.sh.diff
2015-09-25 15:03 x42 Note Added: 0017354
2015-09-26 11:05 Houston4444 Note Added: 0017356
2015-09-26 11:08 Houston4444 File Added: ardour4_debuganywhere.sh
2015-09-26 11:09 Houston4444 Note Added: 0017357
2015-10-17 00:01 x42 Note Added: 0017476
2015-10-17 00:01 x42 Status confirmed => feedback
2015-10-17 08:32 Houston4444 Note Added: 0017477
2015-10-17 11:22 x42 Note Added: 0017479
2015-10-18 08:55 Houston4444 Note Added: 0017490
2015-10-18 09:56 x42 Status feedback => resolved
2015-10-18 09:56 x42 Resolution open => fixed
2015-10-18 09:56 x42 Assigned To => x42
2015-10-18 09:56 x42 Status resolved => closed