From owner-freebsd-stable Sat Mar 17 16:27:47 2001 Delivered-To: freebsd-stable@freebsd.org Received: from earth.backplane.com (earth-nat-cw.backplane.com [208.161.114.67]) by hub.freebsd.org (Postfix) with ESMTP id 874F137B718 for ; Sat, 17 Mar 2001 16:27:45 -0800 (PST) (envelope-from dillon@earth.backplane.com) Received: (from dillon@localhost) by earth.backplane.com (8.11.2/8.9.3) id f2I0RSn96769; Sat, 17 Mar 2001 16:27:28 -0800 (PST) (envelope-from dillon) Date: Sat, 17 Mar 2001 16:27:28 -0800 (PST) From: Matt Dillon Message-Id: <200103180027.f2I0RSn96769@earth.backplane.com> To: Jonathan Lemon Cc: stable@freebsd.org Subject: Re: Not only ftpd's problem with ls */../*..... References: <200103172253.f2HMrZ008412@prism.flugsvamp.com> Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG :Yes, I'm considering the following: : : gl_flags |= GLOB_MAXFILES : gl_match = filemax : :Since gl_match is only used as an input parameter at the moment. :Another approach is to limit the number of bytes returned to ARG_MAX, :but I somewhat dislike that; it makes more sense to me to specify the :number of paths instead. :-- :Jonathan Hmm. Well, I like the idea of adding a flag to glob_t->flags but I would prefer not to add another element to the glob_t structure that would make it incompatible with existing programs. Remember the mess changing FILE caused. How about a combination of glob_t->flags and a global limit that can be set with a new api call, setgloblimit()? Or perhaps even just have the setgloblimit() API call and don't even bother with a new flag. int setgloblimit(int) Set the maximum number of (bytes? entries?) that will be allocated to fullfill a globing call. The previous setting is returned. A value of -1 indicates unlimited. The default is unlimited. Just having a plain old setgloblimit() call with nothing else (no flags, etc...) would be the most compatible solution. Remember when csh had an arbitrarily limit on command line length? Things like 'foreach i ( `find . -type f` )' would fail arbitrarily. Tcsh fixed that problem. Whatever we do, we do not want to reintroduce this same sort of problem in other programs (whether shells do their own globing or not). -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message