/bin/csh crashes on * wildcards of more than 98 files

Bug #2089875 reported by Mark Karmelich
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
csh (Ubuntu)
New
Undecided
Unassigned

Bug Description

This bug is not related to any GUI, but discovered while logged into ubuntu/linux using Putty. Here is the version:

   Welcome to Ubuntu 24.04.1 LTS (GNU/Linux 6.8.0-48-generic x86_64)

The bug is that /bin/csh can no longer wild card more than 98 items. If you try it, /bin/csh crashes with a Segmentation Fault (core dump).

apt-cache policy csh
csh:
  Installed: 20230828-1
  Candidate: 20230828-1
  Version table:
 *** 20230828-1 500
        500 http://archive.ubuntu.com/ubuntu noble/universe amd64 Packages
        100 /var/lib/dpkg/status

Here is a test:

Create two directories, /tmp/test98 and /tmp/test99.

In /tmp/test98, place 98 files of any name or size
In /tmp/test99, place 99 files of any name or size

swimdev3-mark[18]: cd /tmp/test98
swimdev3-mark[19]: /bin/ls -F
01 06 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96
02 07 12 17 22 27 32 37 42 47 52 57 62 67 72 77 82 87 92 97
03 08 13 18 23 28 33 38 43 48 53 58 63 68 73 78 83 88 93 98
04 09 14 19 24 29 34 39 44 49 54 59 64 69 74 79 84 89 94
05 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95
swimdev3-mark[20]: /bin/ls -F *
01 06 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96
02 07 12 17 22 27 32 37 42 47 52 57 62 67 72 77 82 87 92 97
03 08 13 18 23 28 33 38 43 48 53 58 63 68 73 78 83 88 93 98
04 09 14 19 24 29 34 39 44 49 54 59 64 69 74 79 84 89 94
05 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95
swimdev3-mark[21]: cd /tmp/test99
swimdev3-mark[22]: /bin/ls -F
01 06 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96
02 07 12 17 22 27 32 37 42 47 52 57 62 67 72 77 82 87 92 97
03 08 13 18 23 28 33 38 43 48 53 58 63 68 73 78 83 88 93 98
04 09 14 19 24 29 34 39 44 49 54 59 64 69 74 79 84 89 94 99
05 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95
swimdev3-mark[23]: /bin/ls -F *
Segmentation fault (core dumped)

/tmp/test98 has 98 files in it. I can wildcard with “*” and it returns all the files as it should.
/tmp/test99 has 99 files. If I try “ls -F *” it core dumps.

Note that without the -F flag, ls works and returns the file names. But with the -F flag it crashes.

I believe the bug is in /bin/csh, not “ls” or other programs. If you were to try:

cd /tmp/test99
foreach i (*)

/bin/csh will crash and the putty window will disappear.

You don't even have to create the /tmp files above to test this -- any directory with more than 98 files will trigger the crash. E.g.,:

swimdev3-mark[24]: /bin/ls -F /usr/bin/*
Segmentation fault (core dumped)

Or if you want to test foreach without having the putty window crash and disappear, start a new /bin/csh and try it:

swimdev3-mark[25]: /bin/csh
swimdev3-mark[1]: foreach i (/usr/bin/*)
Segmentation fault (core dumped)
swimdev3-mark[26]:

This only happens in /bin/csh. sh and bash do not exhibit this bug.

I have another linux server that has an older version of ubuntu:

    Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-166-generic x86_64)

But 20.04.1 does not have this bug. But the latest ubuntu (24.04) does.

Thanks,
Mark

Tags: bot-comment
description: updated
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Libera.chat.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/2089875/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
affects: ubuntu → csh (Ubuntu)
Revision history for this message
Mark Karmelich (mkarmelich) wrote :

As requested, I specified the package in the bug report -- csh.

I noted that /bin/ls -F * will cause the segmentation fault, and that /bin/ls * (without the -F flag) will not. Upon further testing, it appears that it is not just the -F flag. ANY parameter passed to /bin/ls will cause the segmentation fault. E.g., while using /bin/csh any of these commands will trigger the bug:

/bin/ls -a /usr/bin/*
/bin/ls -r /usr/bin/*
/bin/ls -l /usr/bin/*

And as I noted, it's not limited to /bin/ls. "foreach" will cause /bin/csh to crash. In fact, any of the following commands, and no doubt many others, will trigger a segmentation fault if run from /bin/csh:

foreach i (/usr/bin/*)
echo /usr/bin/*
file /usr/bin/*

Thanks

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.