1

I have three files in a folder: trace-0.fits, trace-1.fits, trace-2.fits.

When I run:

ls trace-?.fits

Only trace-0.fits and trace-2.fits are detected. But:

ls trace-1.fits

Detects trace-1.fits, as expected.

Does anyone know what's going on?

Edit: The OS is gentoo linux, and the file system is ext4. ls *, ls, ls trace-*.fits, and ls *1*.fits also do not show trace-1.fit. The system variable $GLOBIGNORE is not set, and type ls shows that ls is only aliased with the color option ls is aliased to `ls --color=auto

jyoung
  • 61
  • 2
    try ls -b to see if any special characters is there – phuclv Jan 17 '23 at 09:25
  • Does trace-1.fits show up in the output of ls alone? – Stéphane Chazelas Jan 17 '23 at 09:28
  • @phuclv If it had special characters in it, then the ls command that they say works would not work. – Kusalananda Jan 17 '23 at 09:28
  • 1
    ls -b trace-1.fits just returns trace-1.fits. It is not in the output of ls alone. – jyoung Jan 17 '23 at 09:56
  • 1
    What OS and filesystem is that? How about ls *1*? – ilkkachu Jan 17 '23 at 10:47
  • Try again with the wildcard of * and not ? (? Matches the preceding element zero or one time) – dhm Jan 17 '23 at 11:13
  • @dhm that's regex. Here, ? is a single character – Panki Jan 17 '23 at 12:57
  • Does type ls give anything other than ls is /usr/bin/ls? – Chris Davies Jan 17 '23 at 13:18
  • 1
    Could you have excluded it unintentionally (for example, something like GLOBIGNORE='*1*' in bash)? – steeldriver Jan 17 '23 at 13:32
  • The OS is gentoo linux. ls *1* still misses trace-1.fits.

    ls trace-*.fits also misses the file.

    type ls gives ls is aliased to `ls --color=auto' I doubt that's the issue, but I could un-alias if we think that would be a useful experiment.

    @steeldriver, how could I tell? echo $GLOBALIGNORE returns nothing, but could there be something else?

    – jyoung Jan 17 '23 at 18:47
  • "echo $GLOBALIGNORE returns nothing" – The name of the relevant variable is GLOBIGNORE, not GLOBALIGNORE. You should also quote right. – Kamil Maciorowski Jan 17 '23 at 18:56
  • Thanks! echo $GLOBIGNORE also returns nothing. One question I missed from before, the file system is ext4. – jyoung Jan 17 '23 at 18:58
  • things to try: 1. create (touch) those filenames in a different folder. 2. create some other files like abc-0.def abc-1.def etc. 3. what about trace-10.fits for example. 4. what if you rename that file, then rename it back. I'm just spitballing here, so much of that probably seems stupid, but lets face it, this problem looks impossible – Jaromanda X Jan 17 '23 at 23:13
  • Okay, I'm not sure what to make of this, but trace-1.fits completely disappeared. ls trace-1.fits, which had previously detected it, no longer does. I ran touch trace-1.fits to re-create it, and it's now detected by ls trace-?.fits. So, there's not much left to test here. However, I first stumbled across this quirk when looking into a software bug, which I'm nearly sure is related to this issue. I'm going to run the software again to see if I can trigger the problem again, although the the bug may center around a different filename. – jyoung Jan 18 '23 at 03:15
  • Just an update: It turns out that this file system was badly corrupted. It's hard to replicate this specific error, but it seems very likely that this was due to the corruption. – jyoung Jan 21 '23 at 22:10

0 Answers0