I appreciate there are only a few people actively using Matthias's approach
and scripts, but the effects of this one have bugged me for ages whenever
I come to install Xen from a Package User account. I have even asked about
it on the xen-devel list, but yesterday, after mentioning it again,
had an epiphany!

The problem, as seen within the Xen code base, is that a 'make world' does a
'make clean' which removes four directories from the docs directory - man1, man5
man7 and man8 - but those not being there causes the man page creation to fail
later on and, until yesterday, I have never worked out why, going so
far to splilt
the 'make world' into it's constituent parts, vis

make clean
mkdir -p docs/man{1,5,7,8}
make ...

So here's what happens.

The Xen build tries to do this,

install -d -m0755 -p man1

and so on, in the docs directory, however although

/usr/bin/install

would do the right thing

/usr/lib/pkgusr/install

which is the 'install' that a Package User user's $PATH will find
SILENTLY fails to create directories that don't have some form of a
path in them, so, for example, this does work

install -d -m0755 -p ./man1

but without the dot-slash it just fails, and worse still fails silently,
leaving people like me to wonder, for quite a few years now, just
what was going on.

The relevant code in /usr/lib/pkgusr/install ia


        #********** test if we create directories ********************
if [ \( z"$1" = z"-d" \) -o \( z"$1" = z"-m" -a z"$3" = z"-d" \) ]; then
  locdirs=""
  notify=0
  havedir=0
  for((i=$#; $i>0; ))
  do
    a="$1"
    shift 1; i=$(($i-1))
    case "$a" in
      -o|-g|--owner|--group) notify=1
                        shift 1; i=$(($i-1))
                        set -- "$@"
          ;;
      $localedir/*) if [ ! -d "$a" ]; then
                      locdirs="$locdirs ""`expr $a : "$localedir/\(.*\)"`"
                      set -- "$@" "$a"
                      havedir=1
                    else
                      notify=1
                      set -- "$@"
                    fi
                   ;;
      */*|/sbin) if [ ! -d "$a" ]; then
             set -- "$@" "$a"
             havedir=1
           else
             notify=1
             set -- "$@"
           fi
           ;;
      *) set -- "$@" "$a" ;;
    esac
  done

  test $notify -eq 1 -o z"$locdirs" != z && \
                                        echo 1>&2 '***' install "$cmdline"

  test $havedir -eq 0 && exit 0

  $DAISY_CHAIN "$@" || exit $?


and the thing to note is that even though that stanza starts with the
check for the -d,
havedir is initialised to 0, and only gets set to 1 if the target
filename has a slash
in it.

My solution has been to turn the logic around so that havedir is
initialised to 1
and then only gets set to 0 in the else clauses of the places where it was being
set to 1 before.

This seems to work, but can anyone see any issues in doing it that way?


        #********** test if we create directories ********************
if [ \( z"$1" = z"-d" \) -o \( z"$1" = z"-m" -a z"$3" = z"-d" \) ]; then
  locdirs=""
  notify=0
        # We are in a block that knows we have found a -d, so we havedir
  havedir=1
  for((i=$#; $i>0; ))
  do
    a="$1"
    shift 1; i=$(($i-1))
    case "$a" in
      -o|-g|--owner|--group) notify=1
                        shift 1; i=$(($i-1))
                        set -- "$@"
          ;;
      $localedir/*) if [ ! -d "$a" ]; then
                      locdirs="$locdirs ""`expr $a : "$localedir/\(.*\)"`"
                      set -- "$@" "$a"
                    else
                      havedir=0
                      notify=1
                      set -- "$@"
                    fi
                   ;;
      */*|/sbin) if [ ! -d "$a" ]; then
             set -- "$@" "$a"
           else
             havedir=0
             notify=1
             set -- "$@"
           fi
           ;;
      *) set -- "$@" "./$a" ;;
    esac
  done

  test $notify -eq 1 -o z"$locdirs" != z && \
                                        echo 1>&2 '***' install "$cmdline"

  test $havedir -eq 0 && exit 0


I don't suppose Matthias is stiil around ?

And yes, you can invoke the Xen 'make world' as 'make
INSTALL=/usr/bin/install world'
instead.

Kevin
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to