Menu

#15 rpmrebuild cannot rebuild packages with special symbols in the filename

v1.0_(example)
closed
nobody
None
5
2024-09-25
2024-09-04
yuzhen Dong
No

Hi,maintainer:
I found that the current version of rpmrebuild does not build successfully when dealing with some packages, such as giac-doc and deco-archive.You can easily verify this out using fedora 40,like in my screenshot.
The reason is that in the rpmrebuild_files.sh file, the read command cannot read filenames containing spaces and special characters. giac-doc contains filenames with spaces, and deco-archive contains filenames with “\”.
Problem code in rpmrebuild_files.sh file:

while :; do
read file_type
[ -z "$file_type" ] && break
read file_flags
read file_perm
read file_user
read file_group
read file_verify
read file_lang
read file_cap
read file

My mentor yixiangzhike provided a fix that allows the read command to read these special symbols:
1. Mask the built-in IFS separator (the default separator is <space><tab><newline>) when read reads a filename, back up the IFS and set IFS=“” before reading, and restore the old setting after reading. In this way the space at the end of the filename will be preserved when read reads the filename.
2. For directory names that contain the special character '\', change the command “read file” to “read -r file”.
Fix:</newline></tab></space>

read file_verify
read file_lang
read file_cap
  • read file
  • Trailer space may be part of filename.

  • OLD_IFS="$IFS"
  • IFS=""
  • Character backslash may be part of filename also.

  • read -r file
  • IFS="$OLD_IFS"

Will upstream adopt the fix?

1 Attachments

Discussion

  • yuzhen Dong

    yuzhen Dong - 2024-09-04

    Oops, I may have had some formatting issues when I was editing the issue, I'm very sorry. Please see the patch for the exact fix!

     

    Last edit: yuzhen Dong 2024-09-04
  • eric gerbier

    eric gerbier - 2024-09-10
    • status: open --> accepted
     
  • eric gerbier

    eric gerbier - 2024-09-10

    the code has been merged into the devel branch, and will be in next 2.19 release

     
  • eric gerbier

    eric gerbier - 2024-09-25
    • status: accepted --> closed
     
  • eric gerbier

    eric gerbier - 2024-09-25

    the new 2.19 release includes this bugfix
    thanks to report and for the patch

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB