patches: VPATH build of viewres, xedit, xfd, xgc, and xgc fails

Dan Nicholson dbn.lists at gmail.com
Sat Nov 8 08:33:19 PST 2008


On Sat, Nov 8, 2008 at 5:54 AM, Peter Breitenlohner <peb at mppmu.mpg.de> wrote:
> On Fri, 7 Nov 2008, Dan Nicholson wrote:
>
>> On Fri, Nov 7, 2008 at 12:49 AM, Peter Breitenlohner <peb at mppmu.mpg.de>
>> wrote:
>>>
>>> Attached are five tiny patches. Could one of you you please apply them.
>>
>> In order to guard against races with parallel jobs, can you change to
>> `mkdir -p'? ...
>
> Sorry, I missed this aspect (simply repeated what was already done for other
> modules).

mkdir will fail if you try to create a directory that already exists.
So, you use `test -d $dir' first. But that ends up racing if you have
parallel jobs both trying to create that directory:

job1: test -d $dir - doesn't exist
job2: test -d $dir - doesn't exist
job1: mkdir $dir
job2: mkdir $dir

Oops, someone loses.

>> ... It may not matter in cases where there is only one .ad
>> file, but it can't hurt.
>
> However, I would hesitate to use 'mkdir -p'. If I remember correctly there
> are some portability problems (maybe irrelevant for systems supported by
> Xorg).
>
> According to the Autoconf manual a really safe way would be to use
> 'AC_PROG_MKDIR_P' in configure.ac and '$(MKDIR_P)' in Makefile.am -- quite
> some overkill.

Look at a generated Makefile. It's probably already using MKDIR_P
anyway. Here's an example for installing the man pages:

install-drivermanDATA: $(driverman_DATA)
        @$(NORMAL_INSTALL)
        test -z "$(drivermandir)" || $(MKDIR_P) "$(DESTDIR)$(drivermandir)"
        @list='$(driverman_DATA)'; for p in $$list; do \
          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
          f=$(am__strip_dir) \
          echo " $(drivermanDATA_INSTALL) '$$d$$p'
'$(DESTDIR)$(drivermandir)/$$f'"; \
          $(drivermanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(drivermandir)/$$f"; \
        done

It doesn't even bother checking if the directory exists first, but
just fires `mkdir -p' anyway.

> How about simply ignoring errors resulting from mkdir, i.e., using
>        -test -d app-defaults || mkdir app-defaults
> That might produce spurious errors (ignored) for parallel jobs, but if mkdir
> really fails (e.g., a regular file of that name already exists) the next
> command 'cp $< $@' will fail.

Yeah, that'd be fine, too.

--
Dan



More information about the xorg mailing list