tech-userlevel archive

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

Re: bin/44246: enhance mv to work better with xargs



On Mon, 14 Jan 2013, James K. Lowden wrote:

On Mon, 14 Jan 2013 13:15:28 -0800 (PST)
Paul Goyette <paul%whooppee.com@localhost> wrote:

        $ echo * newdir | xargs mv

works.

It only works while the expansion of * is shorter than xargs's
maximum command length.  Once you exceed that limit, you fail.

Hmm?  xargs has no internal "maximum command length" afaik.  xargs
reads from stdin and invokes mv with execve(2).  execve may fail with
E2BIG, but not because of how the xargs command line is formed.

Yeah, I misphrased.

As Christos pointed out, the breakage occurs when the command line used to invoke 'mv' exceeds ARG_MAX - 4096 (or some other value provided to xargs with the -s flag).


-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |
-------------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index