Bug 2277345 - NotoSansMono[wght].ttf file name causes scripts with failglob enabled to fail
Summary: NotoSansMono[wght].ttf file name causes scripts with failglob enabled to fail
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: google-noto-fonts
Version: 40
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Akira TAGOH
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-04-26 12:03 UTC by James Hartsock
Modified: 2024-04-29 13:45 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)

Description James Hartsock 2024-04-26 12:03:52 UTC
shopt failglob
If set, patterns which fail to match filenames during pathname expansion result in an expansion error.

Using this feature is good practice in scripts as helps prevent scripting mistakes; however, having file name with square brackets causes failures. And with Fedora 40 upgrade seems google-noto-sans-mono-vf-fonts-20240301-2.fc40.noarch has added one with:

  /usr/share/fonts/google-noto-vf/NotoSansMono[wght].ttf

Reproducible: Always

Steps to Reproduce:
1. Causes globs that don't expand to cause errors
   $ shopt -s failglob

2. Try use files from rpm as variable, and fail
   $ for file in $(rpm -q --list google-noto-sans-mono-vf-fonts) ; do
     [[ -f "/${file}" ]] || echo "${file}"
   done
   -bash: no match: /usr/share/fonts/google-noto-vf/NotoSansMono[wght].ttf

3. Note the RC
   $ echo $?
   1

4. Or even command line
   $ rpm -qf /usr/share/fonts/google-noto-vf/NotoSansMono[wght].ttf
   -bash: no match: /usr/share/fonts/google-noto-vf/NotoSansMono[wght].ttf

   $ rpm -qf '/usr/share/fonts/google-noto-vf/NotoSansMono[wght].ttf'
   google-noto-sans-mono-vf-fonts-20240301-2.fc40.noarch


Actual Results:  
   -bash: no match: /usr/share/fonts/google-noto-vf/NotoSansMono[wght].ttf


Expected Results:  
no error accessing files with failglob shopt enabled

started fedora 40 upgrade, as daily script of mine fails because this file is included in initramfs too.

Comment 1 James Hartsock 2024-04-26 12:06:35 UTC
FYI google-noto-sans-mono-vf-fonts is installed for me as a vlc dependency

Comment 2 Akira TAGOH 2024-04-26 13:53:57 UTC
There should be no limitations in characters to be used for filename.
That sounds to me like a script bug. shouldn't they try to escape such characters?

FWIW this isn't new. it was there since f38.

Comment 3 James Hartsock 2024-04-26 14:10:09 UTC
Sorry. And the RPM was on my system in F39.  However, it must not have been getting included in initramfs until F40. My script is looking at lsinitrd -k output, and hitting this issue.

Comment 4 James Hartsock 2024-04-26 14:11:30 UTC
Agree, can work around the issue. Not a problem. Wanted to report it, as could be other backup applications that could have issue.

Feel free to close not a bug.

Comment 5 Jens Petersen 2024-04-29 13:45:54 UTC
I think it would make sense to raise this with upstream: it is highly unusual to have brackets in system filenames.
I always thought it looked strange too.


Note You need to log in before you can comment on or make changes to this bug.