package: x2gousbmount Hi $LIST, hi Alex, hi Mike#1, due to a recent bug report on X2Go-User, I needed to take a closer look at the x2gousbmount package, and the script /usr/lib/x2go/tce/x2gousbmount in it. I'll be referencing http://code.x2go.org/gitweb?p=x2gothinclient.git;a=blob;f=usbmount/x2gousbmount;h=4da1fbd90b14dda1beb230ea4b08441a77d9e4eb;hb=75211b6e724bd896d85d915c754703cabcf37187 for line numbers below, even though that version is more advanced as the one in the stable x2gousbmount package. I'm hoping that Alex or someone else that has a clue wrt/ Perl and this script can shed some light on these issues. Mike#1, you're in CC due to issue #3, which seems to have been introduced in your commit. Feel free to suggest I should turn every issue into a separate bug report - I'm not filing them separately at the moment because the issues seem all more or less interconnected, so I figured I should start with one bug report for "the big picture". Issue #1: Lines 88 and 138 contain a call ... expand_filename("~x2gothinclient ... Now, I understand that this is an attempt to determine the path to the home directory of the user named "x2gothinclient". Which, in the classic X2Go-TCE, is "/var/lib/x2gothinclient". So far, so good. But: Lines 107 and 148 contain what looks to me like a subtle typo: ... expand_filename("~/x2gothinclient ... Which means, instead of selecting the home directory of the user x2gothinclient, it would go to the home directory of the user under which the script is being executed, and a subdirectory "x2gothinclient" there, so most likely /root/x2gothinclient (which doesn't exist) So the script will probably fail whenever it encounters encrypted volumes. (I can't test this myself, I don't have a setup with encrypted USB media.) Issue #2: The user name "x2gothinclient" is hardcoded in several places inside the script. This calls at least for a "my $user='x2gothinclient';" at the beginning of the script, and the replacement of every occurrence of "x2gothinclient" with "$user". The reason being that TCE-Live uses a different user name, namely "user" (and a different home directory, /home/user), so we need to be able to swap out the name in one central location. There are two ways of determining that we're running in TCE-Live, I am not sure which one would be the preferable one: 1) Checking /proc/cmdline for the appearance of (in regex syntax) "\W*live\W*" or "\W*boot=live\W*" (in case your mail software turns asterisks into bold type, there's an asterisk after each capital W). 2) Checking if the directory /lib/live or /lib/live/config exists. If any of these match, then $user should be set to 'user' instead of 'x2gothinclient'. Issue #3: Comparing the master branch in git with the version in stable, line 37 is different. There now is an additional check for the existence of a directory "/usr/share/doc/x2gothinclient-minidesktop". Which script/package creates this directory and why is it equivalent to detecting a running x2gothinclientd? Looks like http://code.x2go.org/gitweb?p=x2gothinclient.git;a=commit;h=a458a1ed666eb12b5d856812396ecd31fba01585 introduced that change, see http://code.x2go.org/gitweb?p=x2gothinclient.git;a=commit;h=a458a1ed666eb12b5d856812396ecd31fba01585 but there's no meaningful commit message. Mike#1? Issue #4: I am unhappy with the subroutine check_x2gothinclientd. Indeed, grepping for substrings so you don't trigger on the parameters of your own grep command in the output of ps is a neat hack, but a hack remains a hack. The clean way of handling this, IMO, would be to change the subroutine as follows: sub check_x2gothinclientmode { # check if X2GoClient is running in thinclient mode # old code would check if x2gothinclientd was running, # which fails on X2Go-TCE-live my $x=`ps u -C x2goclient`; if ( $x=~m/\W*--thinclient\W*/ ) { return 1; } return 0; } This will no longer detect if x2gothinclientd is running, but if x2goclient has been called with parameter --thinclient. Which should be the case in both TCE-Classic and TCE-Live. Due to the name change of the subroutine, line 37 needs to be changed to use check_x2gothinclientmode instead of check_x2gothinclientd. Maybe the changed check means the || - part in line 37 is no longer needed as well? Issue #5: Lines 88 and 138 silently assume that there is a subdirectory "export". I can't see it being created anywhere, though. Same goes for lines 107 and 148 and the subdirectory "logins". Issue #6: Why do we need two separate subdirectories "export" and "logins", anyways? Issue #7: Somewhere around line 48, I'm missing a comment that explains what this part of the code is for. I would suggest adding: # mntdir is not the directory where the mountpoint will be rooted, # but where tracking of mount states takes place Issue #8: Why do we have to track these mountpoints manually, anyways? Is the information in /proc/mounts insufficient? -Stefan -- BAUR-ITCS UG (haftungsbeschränkt) Geschäftsführer: Stefan Baur Eichenäckerweg 10, 89081 Ulm | Registergericht Ulm, HRB 724364 Fon/Fax 0731 40 34 66-36/-35 | USt-IdNr.: DE268653243