parallel
[Top][All Lists]
Advanced

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

Re: --transfer with absolute path does not respect --workdir


From: Jay Hacker
Subject: Re: --transfer with absolute path does not respect --workdir
Date: Mon, 18 Jun 2012 13:13:20 -0400

It seems you are saying that keeping {} exactly the input you gave is
important, and having --transfer change it is surprising.  I can
understand that.  It seems like the underlying issue is that when we
move files to remote machines, the paths (can) change; so we have to
do some magic to "make it work."  The magic is either changing the
working directory or changing the path (the {}).  Both have
inconsistencies: for the former we sometimes have to ignore --workdir,
and for the latter we have to change {}.

So perhaps solution is not to do magic; just let it break.  Always put
files in workdir and never change {}; if the user wants to transfer
absolute source files to workdir-relative destination, they can put
\$PWD{} in their commands.  If you really want to put files at an
absolute path, use --workdir=/

I personally feel that it is more useful to have --transfer change {},
since presumably I transferred a file so I can work on it, and not on
the string I gave on the command line.  The change is simple and
consistent: --transfer always removes leading slashes.  I would also
argue that sometimes ignoring --workdir makes it impossible to
transfer some files, which is not acceptable. But if consistency is
more important than usefulness, we should be consistent all around.


On Fri, Jun 15, 2012 at 10:41 AM, Ole Tange <tange@gnu.org> wrote:
> If you change the replacementstring what should these then do:
>
> $ parallel -S localhost --workdir /tmp ls ::: /etc/issue

ls /etc/issue
# no --transfer, no change

> $ parallel -S localhost ls ::: /etc/issue

ls /etc/issue
# no --transfer, no change

> $ parallel -S localhost --transfer ls ::: foo/bar.txt

ls foo/bar.txt
# --transfer, so strip leading slash; working dir = $HOME

> $ parallel -S localhost --transfer ls ::: $PWD/foo/bar.txt

ls pwd/without/slash/foo/bar.txt
# --transfer, so strip leading slash; working dir = $HOME

> If I wanted to --transfer from an absolute path to an absolute path,
> how would I do that using your syntax?

$ parallel -S localhost --transfer --workdir=/ ls ::: /etc/issue

ls etc/issue
# --transfer, so strip leading slash; working dir = /



reply via email to

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