coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [coreutils] cp --parents parallel


From: Rob Gom
Subject: Re: [coreutils] cp --parents parallel
Date: Mon, 18 Oct 2010 21:56:51 +0200

[cut]
>
>  sleep 3
>  rm -rf "$tmpdir"
> done
>
> If you are dealing with multiple concurrent processes that all modify
> the same files in the same directory then I have to ask if that is
> really the best way of doing things?  At the least you will need to
> take appropriate steps to ensure that the result of race conditions is
> a correct result.
>
> Bob
>
Thank you very much for your answer.
Regarding my example - I am aware of bashism. That was only an example
and it was more convenient for me to use bash features.

As for the real case - I use it inside makefiles. I copy many
directory structures into single root. If --parents itself works as
expected, that will be the easiest solution. Generally it looks like:
target:
    cp --parents --update $(FILES_LIST) $(TARGET)

Both FILES_LIST and TARGET contains directory part. I could use something like:
target: $(directory $(TARGET)/$(FILES_LIST))
    cp $(FILES_LIST) $(TARGET)

$(directory $(TARGET)/$(FILES_LIST)):
     mkdir --parents $@

(pseudo code, not working). As you can see, it's more complicated than
simple cp, so I wanted to avoid that.

By the way, I have just reproduced the issue on Debian with coreutils
8.5. To my surprise, it's much less frequent, though. However this is
a completely different machine - that may explain the behaviour (I
haven't seen relevant change in general release notes between 7.4 and
8.5).

Thank you again for detailed answer.

Regards,
Robert



reply via email to

[Prev in Thread] Current Thread [Next in Thread]