Article View: news.software.nntp
Article #74236Re: Renaming a newsgroup
From: John F. Morse
Date: Tue, 12 Sep 2006 16:01
Date: Tue, 12 Sep 2006 16:01
196 lines
8073 bytes
8073 bytes
Jeffrey M. Vinocur wrote: >In article <b5fNg.106750$5i3.29042@bgtnsc04-news.ops.worldnet.att.net>, >John F. Morse <xanadu.bbs@invalid.net> wrote: > > >>perl renamer.pl [...] >> >> > >Incidentally, if you `chmod a+x renamer.pl` (and make sure the >first line of the script points to where Perl actually is on your >system), you can run this without needing the "perl" in front. > > Noted. I'll make this chmod. Thanks. >>I was getting an "Argument list too long" failure. [...] >> >>I'll let it set until I hear from you, just in case you want to try a >>Perl script modification, and want me to test it. >> >> > >Oh, I probably ought to make the script smart enough to recurse >into directories itself, since people probably almost always run >it on a whole directory of files. But I probably won't bother, >because... > >This is a common problem of the shell's argument processing, that >manifests with many programs that take a very long list of files >as input. The workaround (assuming the program can be run on >subsets of the files without the details/orders of the arguments >being important) is to do something like this: > > find . -type f -print | xargs renamer.pl oldgroup newgroup > >which will run renamer.pl repeatedly on different batches of >input files. The "." after find is the path to start looking in >(here, the current directory), -type f means only true files (not >directories etc), and -print is usually not necessary but tells >find to output the list of files it located, one per line. > >You should know that the above command won't work with special >characters (including white space) in filenames. That's not a >problem here, but for future reference, the safer invocation is: > > find . -type f -print0 | xargs -0 renamer.pl oldgroup newgroup > >or whatever. That uses a special delimiter so xargs doesn't have >to guess how to separate out the filenames. However, not all >versions of find/xargs know how to do this, so you can't rely on >it always being available. > I'll try this on the copied (backup) set of the original directories (groups) on news2 after I finish the makehistory and test what I've done so far. I'll also make Dr.Ruud's change to the script. I couldn't locate my notes of a year ago, so I tried "makehistory -b -f history.n -I -O" and will see if that works after renaming to remove the .n in the four filenames. Recursing into the directories is one problem that was overcome by supplying each directory name. (See the session below.) However the "Argument list too long" failures were due to too many filenames, or possibly too much data -- data being too many filenames. Perhaps the 128 MB of RAM is not enough for the complete file? I read something about "slurping" in perlintro(1): "Reading in the whole file at one time is called slurping. It can be useful but it may be a memory hog. Most text file processing can be done a line at a time with Perl's looping constructs." This looping might be the fix needed if the script did indeed try to read in all of the filenames. I don't know -- I'm a very beginning Perl user, and not a programmer by a long shot. Or, as you stated a shell problem. This Debian install uses sh for user news. I wonder if bash would be better? Below is the session to rename the groups. I ran "time" on each command to see how long each took. As you can see, I had the "Argument list too long" failure until I tried renaming by just the first numeral of the files. Then it worked fine until I got down to the 2* filenames. There were too many 2* files, so I had to break this down into smaller (tenths) groups of files. Not shown are times for files from 9* down to 6* because the highest numbered article is 47283. So I timed 5* for a small group, then proceeded downward. The 2* group failed, but surprisingly the 1* ran without error. I suspect this is because of a loss of a lot of the early messages on the RumorMill server back on January 30-31, 2002. I had used pullnews with inn.conf xrefslave set to true to keep the article numbers the same when I pulled them into INN last year. sh-2.05b$ pwd /var/spool/news/articles/xanadu sh-2.05b$ perl ~/renamer.pl test xanadu.test */* sh: /usr/bin/perl: Argument list too long sh-2.05b$ perl ~/renamer.pl brisbee xanadu.brisbee brisbee/* sh: /usr/bin/perl: Argument list too long sh-2.05b$ perl ~/renamer.pl brisbee xanadu.brisbee brisbee/9* sh-2.05b$ perl ~/renamer.pl brisbee xanadu.brisbee brisbee/8* sh-2.05b$ perl ~/renamer.pl brisbee xanadu.brisbee brisbee/7* sh-2.05b$ perl ~/renamer.pl brisbee xanadu.brisbee brisbee/6* sh-2.05b$ time perl ~/renamer.pl brisbee xanadu.brisbee brisbee/5* real 0m9.168s user 0m3.160s sys 0m2.820s sh-2.05b$ time perl ~/renamer.pl brisbee xanadu.brisbee brisbee/4* real 2m37.374s user 0m37.390s sys 0m21.020s sh-2.05b$ time perl ~/renamer.pl brisbee xanadu.brisbee brisbee/3* real 0m43.336s user 0m18.620s sys 0m10.490s sh-2.05b$ time perl ~/renamer.pl brisbee xanadu.brisbee brisbee/2* sh: /usr/bin/perl: Argument list too long real 0m1.142s user 0m0.800s sys 0m0.120s sh-2.05b$ time perl ~/renamer.pl brisbee xanadu.brisbee brisbee/1* real 0m1.115s user 0m0.800s sys 0m0.080s sh-2.05b$ time perl ~/renamer.pl brisbee xanadu.brisbee brisbee/20* real 0m10.458s user 0m3.960s sys 0m2.810s sh-2.05b$ time perl ~/renamer.pl brisbee xanadu.brisbee brisbee/21* real 0m8.204s user 0m3.480s sys 0m2.530s sh-2.05b$ time perl ~/renamer.pl brisbee xanadu.brisbee brisbee/22* real 0m8.998s user 0m3.400s sys 0m2.220s sh-2.05b$ time perl ~/renamer.pl brisbee xanadu.brisbee brisbee/23* real 0m8.710s user 0m3.720s sys 0m2.280s sh-2.05b$ time perl ~/renamer.pl brisbee xanadu.brisbee brisbee/24* real 0m9.350s user 0m3.550s sys 0m2.350s sh-2.05b$ time perl ~/renamer.pl brisbee xanadu.brisbee brisbee/25* real 0m11.363s user 0m4.430s sys 0m2.670s sh-2.05b$ time perl ~/renamer.pl brisbee xanadu.brisbee brisbee/26* real 0m10.375s user 0m4.840s sys 0m2.550s sh-2.05b$ time perl ~/renamer.pl brisbee xanadu.brisbee brisbee/27* real 0m13.210s user 0m5.200s sys 0m2.700s sh-2.05b$ time perl ~/renamer.pl brisbee xanadu.brisbee brisbee/28* real 0m11.433s user 0m5.330s sys 0m2.500s sh-2.05b$ time perl ~/renamer.pl brisbee xanadu.brisbee brisbee/29* real 0m8.835s user 0m4.120s sys 0m2.320s -- John
Technical Details
Message-ID:
<lRANg.29529$QM6.7885@bgtnsc05-news.ops.worldnet.att.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wn13feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!17a21c27!not-for-mailReferences:
<AiTMg.17827$QM6.1566@bgtnsc05-news.ops.worldnet.att.net> <ee3bcp$sqa$1@puck.litech.org> <OwbNg.22657$QM6.20750@bgtnsc05-news.ops.worldnet.att.net> <b5fNg.106750$5i3.29042@bgtnsc04-news.ops.worldnet.att.net> <ee6g0n$k08$1@puck.litech.org>Show Full Headers
Complete Article Headers
Message-ID: <lRANg.29529$QM6.7885@bgtnsc05-news.ops.worldnet.att.net> Subject: Re: Renaming a newsgroup Date: Tue, 12 Sep 2006 16:01:21 GMT From: "John F. Morse" <xanadu.bbs@invalid.net> References: <AiTMg.17827$QM6.1566@bgtnsc05-news.ops.worldnet.att.net> <ee3bcp$sqa$1@puck.litech.org> <OwbNg.22657$QM6.20750@bgtnsc05-news.ops.worldnet.att.net> <b5fNg.106750$5i3.29042@bgtnsc04-news.ops.worldnet.att.net> <ee6g0n$k08$1@puck.litech.org> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wn13feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!17a21c27!not-for-mail Reply-To: xanadu.bbs@invalid.net Organization: Xanadu BBS User-Agent: Debian Thunderbird 1.0.2 (X11/20060423) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: news.software.nntp In-Reply-To: <ee6g0n$k08$1@puck.litech.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Lines: 196 NNTP-Posting-Host: 82ad83e994874174caf1b7eb8d400c3a X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1158076881 NNTP-Posting-Date: Tue, 12 Sep 2006 16:01:21 GMT