zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: Avoid \e in C code; building on Solaris 11
Date: Fri, 08 Dec 2023 19:28:52 +0100	[thread overview]
Message-ID: <50885-1702060132.779123@YSiF.CgC_.vGLi> (raw)

A couple of uses of the non-standard \e in C strings have crept into the
code in relatively recent patches. Most modern compilers support this
but the Solaris compiler doesn't and \033 should be used instead.

Incidentally, .sh.edmode doesn't appear to work on any system in
my testing, even on other platforms. I get an empty variable and
${#.sh.edmode} remains zero.

The change to makepro.awk in 44637 also means that AWK=gawk is needed
with the configure script on Solaris. Even before, I tended to use
AWK=nawk and as it silences an ugly warning on modern systems I wouldn't
back that patch out. Annoyingly, it does leave a size zero
Src/builtin.syms and make clean then doesn't delete that (it fails) and
a subsequent attempt with gawk then fails to compile builtin.c. For GNU
make there is a .DELETE_ON_ERROR: target that would solve that but I
can't see an equivalent for Sun make.

The test cases now expect diff to have a -a option which it doesn't on
Solaris. That was changed in ztst.zsh in 2017 and I don't see much need
to change this.

B03print fails on Tab expansion by print. This is because the test
expects tr '\0' Z to work which it doesn't. Neither does the full octal
'\000' or $'\0'. I'm not clear on what purpose that trailing null has
for the test but it is commented with "regression test for multibyte tab
expand".

/dev/fd tests are being skipped because it doesn't detect /dev/fd.
That test is: echo ok|(exec 3<&0; cat /dev/fd/3 2>/dev/null;)
It works with bash or zsh on Solaris 11 but not with sh or ksh
On Solaris 10, it does work with /bin/sh (just not with ksh)
Any idea why the use of fd 3 is needed in our test? It works with just:
  echo ok|(cat /dev/fd/0 2>/dev/null;)
I've tried a few variations such as (/bin/echo ok;sleep 1)|
without success.

Aside from that, there are a couple of failures in W02jobs which I can't
repdroduce outside of the test system.

Oliver

diff --git a/Src/Modules/ksh93.c b/Src/Modules/ksh93.c
index 51999dd71..9af5e1d69 100644
--- a/Src/Modules/ksh93.c
+++ b/Src/Modules/ksh93.c
@@ -171,7 +171,7 @@ ksh93_wrapper(Eprog prog, FuncWrap w, char *name)
 	/* bindkey -v forces VIMODE so this test is as good as any */
 	if (curkeymapname && isset(VIMODE) &&
 	    strcmp(curkeymapname, "main") == 0)
-	    strcpy(sh_edmode, "\e");
+	    strcpy(sh_edmode, "\033");
 	else
 	    strcpy(sh_edmode, "");
 	if (!sh_edchar)
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index 51bb43339..e2b86e863 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -977,7 +977,7 @@ cuttext(ZLE_STRING_T line, int ct, int flags)
 	unmetafy(mbcut, &cutll);
 	mbcut = base64_encode(mbcut, cutll);
 
-	fprintf(shout, "\e]52;%c;%s\a", zmod.flags & MOD_CLIP ? 'c' : 'p',
+	fprintf(shout, "\033]52;%c;%s\a", zmod.flags & MOD_CLIP ? 'c' : 'p',
 		mbcut);
     } else if (zmod.flags & MOD_VIBUF) {
 	struct cutbuffer *b = &vibuf[zmod.vibuf];


             reply	other threads:[~2023-12-08 18:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08 18:28 Oliver Kiddle [this message]
2023-12-08 22:03 ` Bart Schaefer
2023-12-08 22:15   ` Bart Schaefer
2023-12-09 23:04     ` Oliver Kiddle
2023-12-10  0:29       ` Bart Schaefer
2023-12-09 22:41   ` Oliver Kiddle
2023-12-09 23:43   ` Oliver Kiddle
2023-12-10  0:33     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50885-1702060132.779123@YSiF.CgC_.vGLi \
    --to=opk@zsh.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).