From nobody@FreeBSD.org  Wed Jun  1 08:15:03 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A2E50106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  1 Jun 2011 08:15:03 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 92C498FC15
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  1 Jun 2011 08:15:03 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p518F2Nx006540
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 1 Jun 2011 08:15:02 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p518F2Tw006538;
	Wed, 1 Jun 2011 08:15:02 GMT
	(envelope-from nobody)
Message-Id: <201106010815.p518F2Tw006538@red.freebsd.org>
Date: Wed, 1 Jun 2011 08:15:02 GMT
From: vermaden <vermaden@interia.pl>
To: freebsd-gnats-submit@FreeBSD.org
Subject: update ls/rm/mv/cp tools to be able to handle large amount of files
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         157491
>Category:       misc
>Synopsis:       update ls/rm/mv/cp tools to be able to handle large amount of files
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 01 08:20:10 UTC 2011
>Closed-Date:    Sat Jun 04 22:56:03 UTC 2011
>Last-Modified:  Sat Jun 04 22:56:03 UTC 2011
>Originator:     vermaden
>Release:        8.2-RELENG_8-20110411-JPSNAP
>Organization:
>Environment:
FreeBSD e6400 8.2-RELENG_8-20110411-JPSNAP FreeBSD 8.2-RELENG_8-20110411-JPSNAP #0: Mon Apr 11 04:35:01 UTC 2011     root@build-amd64-fbsd.allbsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
The 'basic' tools like ls/mv/cp/rm are not able to handle large amount of files:

# ls /var/db/portsnap/files | wc -l
   22682

# ls /var/db/portsnap/files/*
zsh: argument list too long: ls

# mv /var/db/portsnap/files/* /tmp
zsh: argument list too long: mv

>How-To-Repeat:
These for about 22000 files and more:

ls /var/db/portsnap/files/*
mv /var/db/portsnap/files/* /tmp
>Fix:
Increase these tools limits.

>Release-Note:
>Audit-Trail:

From: Eitan Adler <lists@eitanadler.com>
To: bug-followup@freebsd.org, vermaden@interia.pl
Cc:  
Subject: Re: misc/157491: update ls/rm/mv/cp tools to be able to handle large
 amount of files
Date: Wed, 1 Jun 2011 11:59:36 +0000

 The limit is not in these tools. It is a constant number, defined in
 bytes, in the kernel. This is designed to keep the amount of memory
 required to store these command line options bounded.
 You could see the value with
 $getconf ARG_MAX
 262144
 
 I suggest you use find + xargs which automatically will figure out the
 correct number of arguments and run the command for you.
 
 -- 
 Eitan Adler
State-Changed-From-To: open->closed 
State-Changed-By: eadler 
State-Changed-When: Sat Jun 4 22:52:43 UTC 2011 
State-Changed-Why:  
As stated in the GNATS record this limit is alreadu quite high and raising it is not required. Other tools, like xargs, could be used instead 

http://www.freebsd.org/cgi/query-pr.cgi?pr=157491 
>Unformatted:
