Hello,

When executing the script source/scripts/distinst (SGE 8.1.9) while the
current account

is not root, there is 'chown 0:0' or 'install -o 0 -g 0' commands executed.

This breaks a build in a user directory (I build installation packages
so install is done

as the current user, not root).

Joined, you will find a patch which corrects this behaviour (never try
to change

owner when not root).


Expecting this can help,

Regards

--

Philippe Poilbarbe

CLS - Collecte Localisation Satellites

________________________________

Ce message et toutes les pièces jointes (ci-après le "message") sont établis à 
l'intention exclusive de ses destinataires et sont confidentiels. Si vous 
recevez ce message par erreur ou s'il ne vous est pas destiné, merci de le 
détruire ainsi que toute copie de votre système et d'en avertir immédiatement 
l'expéditeur. Toute lecture non autorisée, toute utilisation de ce message qui 
n'est pas conforme à sa destination, toute diffusion ou toute publication, 
totale ou partielle, est interdite. L'Internet ne permettant pas d'assurer 
l'intégrité de ce message électronique susceptible d'altération, l’expéditeur 
(et ses filiales) décline(nt) toute responsabilité au titre de ce message dans 
l'hypothèse où il aurait été modifié ou falsifié.

This message and any attachments (the "message") is intended solely for the 
intended recipient(s) and is confidential. If you receive this message in 
error, or are not the intended recipient(s), please delete it and any copies 
from your systems and immediately notify the sender. Any unauthorized view, use 
that does not comply with its purpose, dissemination or disclosure, either 
whole or partial, is prohibited. Since the internet cannot guarantee the 
integrity of this message which may not be reliable, the sender (and its 
subsidiaries) shall not be liable for the message if modified or falsified.
diff -Naur sge-8.1.9.orig/source/scripts/distinst sge-8.1.9/source/scripts/distinst
--- sge-8.1.9.orig/source/scripts/distinst	2016-02-28 19:23:26.000000000 +0100
+++ sge-8.1.9/source/scripts/distinst	2016-06-13 11:24:39.044366000 +0200
@@ -190,6 +190,15 @@
 
 #-------------------------------------------------------------------------
 #
+ChownIfRoot()
+{
+   if [ $IAMROOT = true ]; then
+      Execute chown "$@"
+   fi
+}
+
+#-------------------------------------------------------------------------
+#
 SetArchBin()
 {
    BUILDARCH=`$GE_SOURCEDIR/scripts/compilearch -b $1`
@@ -324,7 +333,7 @@
                                 -name ".#*" -o -name "*.swp" \) \
                               -type f -exec rm -f {} \;
       if [ $IAMROOT = true ]; then
-         Execute chown -R 0:0 $DEST_SGE_ROOT/$i
+         ChownIfRoot -R 0:0 $DEST_SGE_ROOT/$i
       fi
    done
 }
@@ -336,12 +345,15 @@
    target_uid=`echo $1 | cut -d. -f1`
    target_gid=`echo $1 | cut -d. -f2`
    if [ -n "$INSTALL" ]; then
-      Execute "$INSTALL" -o $target_uid -g $target_gid -m "$2" "$3" "$4"
+      if [ $IAMROOT = true ]; then
+         Execute "$INSTALL" -o $target_uid -g $target_gid -m "$2" "$3" "$4"
+      else
+         Execute "$INSTALL" -m "$2" "$3" "$4"
+      fi
    else
       Execute cp $3 $4
       if [ $IAMROOT = true ]; then
-         Execute chown $target_uid "$4"
-         Execute chgrp $target_gid "$4"
+         ChownIfRoot $target_uid:$target_gid "$4"
       fi
       if [ -d $4 ]; then
          Execute chmod $2 $4/`basename $3`
@@ -1310,7 +1322,7 @@
       (cd $DEST_SGE_ROOT; \
        Execute $TAR xvpzf $ARCO_SOURCE_DIR/dbwriter/dbwriter.tar.gz; \
        Execute $TAR xvpzf $ARCO_SOURCE_DIR/reporting/reporting.tar.gz; \
-       chown -R root:root $DEST_SGE_ROOT/reporting $DEST_SGE_ROOT/dbwriter )
+       ChownIfRoot -R root:root $DEST_SGE_ROOT/reporting $DEST_SGE_ROOT/dbwriter )
       Cleanup reporting dbwriter 
       echo ARCo part done
       echo
@@ -1353,12 +1365,12 @@
       )
       Execute mkdir -p $DEST_SGE_ROOT/bin
       Execute cp $ABSOLUTE_SGE_INSPECT_SRC_DIR/scripts/sgeinspect.sh $DEST_SGE_ROOT/bin/
-      chown root:root $DEST_SGE_ROOT/bin/sgeinspect.sh
+      ChownIfRoot root:root $DEST_SGE_ROOT/bin/sgeinspect.sh
       Execute chmod 755 $DEST_SGE_ROOT/bin/sgeinspect.sh
       
       if [ -f $ABSOLUTE_SGE_INSPECT_SRC_DIR/scripts/logging.properties ]; then
          Execute cp $ABSOLUTE_SGE_INSPECT_SRC_DIR/scripts/logging.properties $DEST_SGE_ROOT/sgeinspect/etc
-         chown root:root $DEST_SGE_ROOT/sgeinspect/etc/logging.properties
+         ChownIfRoot root:root $DEST_SGE_ROOT/sgeinspect/etc/logging.properties
          Execute chmod 644 $DEST_SGE_ROOT/sgeinspect/etc/logging.properties
       fi
 
_______________________________________________
SGE-discuss mailing list
SGE-discuss@liv.ac.uk
https://arc.liv.ac.uk/mailman/listinfo/sge-discuss

Reply via email to