Debian bug report logs - #1247
perl <...> globbing only works if (t)csh installed

Package: perl; Reported by: Peter Tobias <tobias@et-inf.fho-emden.de>, iwj10@cus.cam.ac.uk (Ian Jackson); 79 days old.

Message received at debian-bugs:


From cus.cam.ac.uk!iwj10 Sun Aug 13 17:12:10 1995
Return-Path: <iwj10@cus.cam.ac.uk>
Received: from pixar.com by mongo.pixar.com with smtp
	(Smail3.1.28.1 #15) id m0shn8T-000Ds7C; Sun, 13 Aug 95 17:12 PDT
Received: from bootes.cus.cam.ac.uk by pixar.com with SMTP id AA10980
  (5.67b/IDA-1.5 for debian-bugs-pipe@mongo.pixar.com); Sun, 13 Aug 1995 17:12:02 -0700
Received: by bootes.cus.cam.ac.uk 
	(Smail-3.1.29.0 #36) id m0shn8K-000C06C; Mon, 14 Aug 95 01:12 BST
Received: by chiark
	id <m0shcrp-0002ZZZ@chiark.al.cl.cam.ac.uk>
	(Debian /\oo/\ Smail3.1.29.1 #29.33); Sun, 13 Aug 95 14:14 BST
Message-Id: <m0shcrp-0002ZZZ@chiark.al.cl.cam.ac.uk>
Date: Sun, 13 Aug 95 14:14 BST
From: Ian Jackson <iwj10@cus.cam.ac.uk>
To: Debian bugs submission address <debian-bugs@pixar.com>
Reply-To: Peter Tobias <tobias@et-inf.fho-emden.de>,
        iwj10@cus.cam.ac.uk (Ian Jackson)
Subject: perl <...> globbing only works if (t)csh installed

Package: perl
Version: 5.0001-3

As you can see from the transcript below, Perl's <...> globbing only
works if you have tcsh installed.

I surmise that this is related to the following info, from perlop(1):

       ...  Example:

           while (<*.c>) {
               chmod 0644, $_;
           }

       is equivalent to

           open(FOO, "echo *.c | tr -s ' \t\r\f' '\\012\\012\\012\\012'|");
           while (<FOO>) {
               chop;
               chmod 0644, $_;
           }

       In fact, it's currently implemented that way.  (Which
       means it will not work on filenames with spaces in them
       unless you have csh(1) on your machine.)

So, what is probably happening is that it is failing for users who
don't have tcsh *installed*, because the person who built Perl did
have csh installed and so Perl was configured to use it.

Clearly this is not acceptable.  However, a version of Perl whose
globbing doesn't work for filenames with spaces is also unacceptable
(and that's presumably what you'd get if you rebuilt Perl configured
to think that csh wasn't available).

Perl should be fixed to use the C library `glob' function - this will
also fix the other problems described in perlop(1):

       Because globbing invokes a shell, it's often faster to
       call readdir() yourself and just do your own grep() on the
       filenames.  Furthermore, due to its current implementation
       of using a shell, the glob() routine may get "Arg list too
       long" errors (unless you've installed tcsh(1L) as
       /bin/csh).

Thanks to Peter Tobias for spotting this problem and asking me about
it in private email.

Ian.

chiark:~/junk> dpkg -l '*csh*'
Desired=Unknown/Install/Remove/Purge
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required
||/ Name         Version   Rev  Description
+++-============-=========-====-===============================================
ii  tcsh              6.05 4    An enhanced version of the Berkeley C shell.
chiark:~/junk> perl -e '@x=<t*>; print "@x\n";'
t.c t.cc t.cc~ t.cpio t.c~ t.o t.old t.pl t.pl~ tar termcap test.ld touchdata trinity.wad.gz trn-to-addnewsgroup.pl trn-to-addnewsgroup.pl~ ts typescript tzu t~
chiark:~/junk> really dpkg --purge tcsh
(Reading database ... 15631 files and directories currently installed.)
Removing tcsh ...
Purging configuration files for tcsh ...
chiark:~/junk> perl -e '@x=<t*>; print "@x\n";'

chiark:~/junk> really dpkg --install /usr/src/debian-archive/binary/shells/tcsh-6.05-4.deb 
Selecting previously deselected package tcsh.
(Reading database ... 15625 files and directories currently installed.)
Unpacking tcsh (from .../binary/shells/tcsh-6.05-4.deb) ...
Setting up tcsh ...

chiark:~/junk> perl -e '@x=<t*>; print "@x\n";'
t.c t.cc t.cc~ t.cpio t.c~ t.o t.old t.pl t.pl~ tar termcap test.ld touchdata trinity.wad.gz trn-to-addnewsgroup.pl trn-to-addnewsgroup.pl~ ts typescript tzu t~
chiark:~/junk> echo t*
t.c t.cc t.cc~ t.cpio t.c~ t.o t.old t.pl t.pl~ tar termcap test.ld touchdata trinity.wad.gz trn-to-addnewsgroup.pl trn-to-addnewsgroup.pl~ ts typescript tzu t~
chiark:~/junk> 

Acknowledgement sent to Peter Tobias <tobias@et-inf.fho-emden.de>, iwj10@cus.cam.ac.uk (Ian Jackson):
New bug report received and forwarded. Full text available.
Report forwarded to debian-devel@pixar.com:
Bug#1247; Package perl. Full text available.
Ian Jackson / iwj10@thor.cam.ac.uk, with the debian-bugs tracking mechanism
This page last modified 07:43:01 GMT Wed 01 Nov