NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

PR/56972 CVS commit: [netbsd-8] src/bin/sh



The following reply was made to PR bin/56972; it has been noted by GNATS.

From: "Martin Husemann" <martin%netbsd.org@localhost>
To: gnats-bugs%gnats.NetBSD.org@localhost
Cc: 
Subject: PR/56972 CVS commit: [netbsd-8] src/bin/sh
Date: Thu, 27 Oct 2022 16:16:50 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Oct 27 16:16:50 UTC 2022
 
 Modified Files:
 	src/bin/sh [netbsd-8]: miscbltin.c
 
 Log Message:
 Pull up following revision(s) (requested by kre in ticket #1779):
 
 	bin/sh/miscbltin.c: revision 1.51
 	bin/sh/miscbltin.c: revision 1.52
 
 PR bin/56972  Fix escape ('\') handling in sh read builtin.
 
 In 1.35 (March 2005) (the big read fixup), most escape handling and IFS
 processing in the read builtin was corrected.  However 2 cases were missed,
 one is a word (something to be assigned to any variable but the last) in
 which every character is escaped (the code was relying on a non-escaped char
 to set the "in a word" status), and second trailing IFS whitespace at
 the end of the line was being deleted, even if the chars had been escaped
 (the escape chars are no longer present).
 
 See the PR for more details (including the case that detected the problem).
 
 After fixing this, I looked at the FreeBSD code (normally might do it
 before, but these fixes were trivial) to check their implementation.
 
 Their code does similar things to ours now does, but in a completely
 different way, their read builtin is more complex than ours needs to
 be (they handle more options).   For anyone tempted to simply incorporate
 their code, note that it relies upon infrastructure changes elsewhere
 in the shell, so would not be a simple cut and drop in exercise.
 
 This needs pullups to -3 -4 -5 -6 -7 -8 and -9 (fortunately this is
 happening before -10 is branched, so will never be broken this way there).
 
  -
 
 Don't output the error for bad usage (no var name given)
 after already writing the prompt (set with the -p option).
 
 That results in nonsense like:
 	$ read -p foo
 	fooread: arg count
 
 While here, improve the error message so it means something.
 
 Now we will get:
 $ read -p foo
 read: variable name required
 Usage: read [-r] [-p prompt] var...
 
 [Detected by code reading while doing the work for the previous fix]
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.44 -r1.44.2.1 src/bin/sh/miscbltin.c
 
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.
 


Home | Main Index | Thread Index | Old Index