patchThe GNU Bourne-Again SHell - Patches: patch #10447, fix mapfile n exec superfluous...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #10447: fix mapfile n exec superfluous input

Submitter:  wangmeng <wangmeng>
Submitted:  Fri 19 Apr 2024 03:37:09 AM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Wont Do Privacy:  Public
Assigned to:  None Open/Closed:  Open

Fri 19 Apr 2024 12:55:10 PM UTC, comment #1: 

This is not a bug; mapfile behaves as documented. It reads input until it encounters a delimiter, then returns.

If you're worried about this situation, follow the call to mapfile with a call to read to consume any remaining input on the line, or use newline as the delimiter and split the line yourself.

Chet Ramey <chet>
Group administrator
Fri 19 Apr 2024 03:37:09 AM UTC, original submission:  

The following command output is displayed when the ‘mapfile -n array’ command is executed:
   "
    [root@29 ~]# mapfile -d ';' -n 2 array
    1;2;ls
    [root@29 ~]# ls
    0402             bash       Downloads             openEuler 
    rpmbuild               Videos
    1070             Desktop    initial-setup-ks.cfg  os_info   
    anaconda-ks.cfg  Documents  Music  
   "
The ls command is automatically executed.


After fix:
   "
    [root@29 bash]# mapfile -d ';' -n 2 array
    1;2;ls
    [root@29 bash]# echo ${array[@]}
    1; 2;
    [root@29 bash]#
   "
ls command is mot executed,and is also not in array

wangmeng <wangmeng>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by wangmeng (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-04-19 chet StatusNone Wont Do
    2024-04-19 wangmeng Attached File- Added 0001-fix-mapfile-n-exec-superfluous-input.patch, #55946

    Back to the top

    Powered by Savane 3.13-c54d.
    Corresponding source code