Musing with my Ubuntu installation did the following experiments as user "rony":

    */--------------- commands as normal user "rony" (no SUDO_* environment 
variables set):/*

    rony@rony-linux:~/work/oorexx/trunk$ *env | grep XDG*
    
/XDG_VTNR=7////XDG_SESSION_ID=c4////XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/rony////XDG_SESSION_TYPE=x11////XDG_DATA_DIRS=/usr/share/mate:/usr/share/mate:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/var/lib/snapd/desktop////XDG_SESSION_DESKTOP=mate////XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0////XDG_CURRENT_DESKTOP=MATE////XDG_SEAT=seat0///*/XDG_RUNTIME_DIR=/run/user/1000/*///XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1////XDG_CONFIG_DIRS=/etc/xdg/xdg-mate:/etc/xdg/

    rony@rony-linux:~/work/oorexx/trunk$ *whoami*
    /rony/

    rony@rony-linux:~/work/oorexx/trunk$ *ls -al $XDG_RUNTIME_DIR*
    /total 0////drwx------ 9 rony rony 260 Dec 19 16:39 .////drwxr-xr-x 3 root 
root 60 Dec 19 16:39
    ..////srw-rw-rw- 1 rony rony 0 Dec 19 16:35 bus////drwx------ 3 rony rony 
60 Dec 19 16:35
    dbus-1////drwx------ 2 rony rony 60 Dec 23 13:52 dconf////drwx------ 3 rony 
rony 160 Dec 23
    13:52 gnupg////dr-x------ 2 rony rony 0 Dec 19 16:35 gvfs////drwx------ 2 
rony rony 100 Dec 19
    16:39 keyring///*/-rw-rw-rw- 1 rony rony 0 Dec 19 16:36 
.ooRexx-5.0.0-64.lock/**//**/srwxrwxrwx
    1 rony rony 0 Dec 19 16:36 .ooRexx-5.0.0-64.service/*///drwx------ 2 rony 
rony 80 Dec 19 16:35
    pulse////drwxr-xr-x 2 rony rony 80 Dec 19 16:35 systemd////-rw------- 1 
rony rony 0 Dec 19 16:35
    update-notifier.pid////rony@rony-linux:~/work/oorexx/trunk$ /

    rony@rony-linux:~/work/oorexx/trunk$ *env | grep SUDO*


    */--------------- same commands as sudo (the XDG* environment variables are 
not set, there is no
    home directory "/usr/root" rather "/root"):/*

    rony@rony-linux:~/work/oorexx/trunk$ *sudo env | grep XDG*

    rony@rony-linux:~/work/oorexx/trunk$ *sudo whoami*
    /root/

    rony@rony-linux:~/work/oorexx/trunk$ *sudo ls -al /root*
    /total 112////drwx------ 24 root root 4096 Dec 19 16:37 .////drwxr-xr-x 29 
root root 4096 Dec 11
    16:40 ..////drwx------ 2 root root 4096 Mar 7 2018 .aptitude////-rw-r--r-- 
1 root root 3106 Feb
    25 2012 .bashrc////drwx------ 10 root root 4096 Oct 24 2015 
.cache////drwx------ 9 root root
    4096 Jun 8 2015 .config////drwx------ 3 root root 4096 Jun 10 2013 
.dbus////drwx------ 3 root
    root 4096 Oct 25 2014 .gconf////drwx------ 2 root root 4096 Sep 30 2011 
.gconfd////drwx------ 4
    root root 4096 Feb 25 2012 .gnome2////drwx------ 2 root root 4096 Aug 3 2011
    .gnome2_private////drwx------ 3 root root 4096 Sep 28 2016 
.gnupg////drwxr-xr-x 2 root root 4096
    Aug 29 2011 .gstreamer-0.10////drwx------ 2 root root 4096 Aug 2 2011 
.gvfs////drwxr-xr-x 3 root
    root 4096 Oct 15 2013 .java////drwx------ 2 root root 4096 Aug 29 2011 
.kde////drwxr-xr-x 3 root
    root 4096 Jul 27 2011 .libreoffice////drwx------ 3 root root 4096 Aug 2 2011
    .local////drwx------ 3 root root 4096 Aug 2 2011 
.mission-control///*/-rw-rw-rw- 1 root root 0
    Dec 19 16:09 .ooRexx-5.0.0-64.lock/**//**/srwxrwxrwx 1 root root 0 Dec 19 
16:37
    .ooRexx-5.0.0-64.service/*///drwxr-xr-x 2 root root 4096 Feb 4 2017
    .oracle_jre_usage////-rw-r--r-- 1 root root 148 Aug 17 2015 
.profile////drwx------ 2 root root
    4096 Oct 14 2014 .pulse////-rw------- 1 root root 256 Jun 7 2011 
.pulse-cookie////drwxr-xr-x 2
    root root 4096 Jan 12 2017 .rpmdb////drwx------ 2 root root 4096 Jun 7 2011 
.ssh////drwx------ 4
    root root 4096 Mar 18 2018 .synaptic////drwxrwxr-x 2 root root 4096 Feb 25 
2012
    Templates////-rw------- 1 root root 2983 Feb 6 2018 .viminfo/
    rony@rony-linux:~/work/oorexx/trunk$ 

    rony@rony-linux:~/work/oorexx/trunk$ *sudo env | grep root*
    /MAIL=/var/mail/root LOGNAME=root USER=root USERNAME=root/
    rony@rony-linux:~/work/oorexx/trunk$ 


    rony@rony-linux:~/work/oorexx/trunk$ *sudo env | grep SUDO*
    
/SUDO_COMMAND=/usr/bin/env////SUDO_USER=rony////SUDO_UID=1000////SUDO_GID=1000/
    rony@rony-linux:~/work/oorexx/trunk$

Obviously last Wednesday ooRexx ran with root privileges and created the lock 
and service files
under "/root". Not sure whether this was caused by doing an "sudo dpkg -i 
ooRexx-deb-packages".

Maybe a strategy could be: if determining that ooRexx executes as "root" (e.g. 
comparing $LOGNAME to
"root"), then create the two special files in the root's homedirectory "/root". 
Otherwise, if
running without the XDG* environment variables set, then maybe in the user's 
home directory $HOME
(like on MacOSX)?

---rony




_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to