On 3/16/17, Bruce Evans <b...@optusnet.com.au> wrote: > On Thu, 16 Mar 2017, Oliver Pinter wrote: > >> On 3/16/17, Bruce Evans <b...@optusnet.com.au> wrote: >>> On Thu, 16 Mar 2017, Bruce Evans wrote: >>> >>>> Log: >>>> Add teken_256to16() to convert xterm-256 256-color codes to xterm >>>> 16-color >>>> codes. This will be used to fix bright colors. >>>> >>>> Improve teken_256to8(). Use a lookup table instead of calculations. >>>> The >>>> ... >>> >>> A shell script for printing some text color maps is attached. Also a >>> sloppier one for printing some CSI sequences. >>> ... >> >> If I'm not wrong, these scripts where made on OS X. They use \r\n line >> endings, >> and this triggers random cryptic runtime errors: >> >> op@opn /tmp> sh -x sc-vt-CSI >> + printf $'\\033[m\r' >> + printf $'\\033[x\r' >> sc-vt-CSI: 5: Syntax error: word unexpected >> >> The simple fix is to delete the '\r's from the scripts: >> >> cat sc-vt-CSI | tr -d '\r' > trans.sh > > No OS X here. > > It means that some mailers mangle even attachments. > > Shells should probably accept \r\n as newline on systems where this is > not the native newline. Some C compilers do.
The problems stats with imgact_shell, you can easily verify this with the following: op@opn /tmp> printf '#\!/bin/sh\r\n' > test.sh op@opn /tmp> chmod +x test.sh op@opn /tmp> ./test.sh ./test.sh: Command not found. op@opn /tmp> sh -x ./test.sh op@opn /tmp> A possible solution would be the following patch: Xdiff --git a/sys/kern/imgact_shell.c b/sys/kern/imgact_shell.c Xindex aaf521cf251..7b3feb20a3c 100644 X--- a/sys/kern/imgact_shell.c X+++ b/sys/kern/imgact_shell.c X@@ -146,7 +146,7 @@ exec_shell_imgact(imgp) X ihp++; X interpb = ihp; X while (ihp < maxp && ((*ihp != ' ') && (*ihp != '\t') && (*ihp != '\n') X- && (*ihp != '\0'))) X+ && (*ihp != '\r') && (*ihp != '\0'))) X ihp++; X interpe = ihp; X if (interpb == interpe) X@@ -162,7 +162,7 @@ exec_shell_imgact(imgp) X while (ihp < maxp && ((*ihp == ' ') || (*ihp == '\t'))) X ihp++; X optb = ihp; X- while (ihp < maxp && ((*ihp != '\n') && (*ihp != '\0'))) X+ while (ihp < maxp && ((*ihp != '\n') && (*ihp != '\r') && (*ihp != '\0'))) X ihp++; X opte = ihp; X if (opte == maxp) this is not tested, even nor compile tested, just a PoC. > > Bruce > _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"