1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Fix 'print -s -f'

This fix is backported from the Vashisht/Rader ksh2020 branch.

src/cmd/ksh93/bltins/print.c:
- Fix syncing history when print -s -f is used. For example, the
  following now correctly adds a 'cd' command to the history:
	print -s -f 'cd -- %q\n' "$PWD"
  Ref.:	https://github.com/att/ast/issues/425
	https://github.com/att/ast/pull/442

src/cmd/ksh93/include/version.h:
- Version date bump.

(cherry picked from commit 46ba7ecdc5c14cd73f6cb24b16c50bdc331a000e)
This commit is contained in:
Martijn Dekker 2020-05-14 11:36:16 +01:00
parent e856094ca2
commit 846ad93272
3 changed files with 16 additions and 2 deletions

8
NEWS
View file

@ -4,6 +4,14 @@ For full details, see the git log at:
Any uppercase BUG_* names are modernish shell bug IDs.
2020-05-14:
- Fix syncing history when print -s -f is used. For example, the
following now correctly adds a 'cd' command to the history:
print -s -f 'cd -- %q\n' "$PWD"
Ref.: https://github.com/att/ast/issues/425
https://github.com/att/ast/pull/442
2020-05-13:
- Fix BUG_CASELIT: an undocumented 'case' pattern matching misbehaviour that

View file

@ -329,7 +329,13 @@ skip2:
} while(*pdata.nextarg && pdata.nextarg!=argv);
if(pdata.nextarg == nullarg && pdata.argsize>0)
sfwrite(outfile,stakptr(staktell()),pdata.argsize);
if(sffileno(outfile)!=sffileno(sfstderr))
/*
* -f flag skips adding newline at the end of output, which causes issues
* with syncing history if -s and -f are used together. So don't sync now
* if sflag was given. History is synced later with hist_flush() function.
* https://github.com/att/ast/issues/425
*/
if(!sflag && sffileno(outfile)!=sffileno(sfstderr))
sfsync(outfile);
sfpool(sfstderr,pool,SF_WRITE);
exitval = pdata.err;

View file

@ -17,4 +17,4 @@
* David Korn <dgk@research.att.com> *
* *
***********************************************************************/
#define SH_RELEASE "93u+m 2020-05-13"
#define SH_RELEASE "93u+m 2020-05-14"