Page MenuHome GnuPG

gen-lock-obj.sh uses echo -n from /bin/sh, which echos "-n"
Closed, ResolvedPublic

Description

In gen-lock-obj.sh--which uses #! /bin/sh--it uses "echo -n" to generate its file... only, the echo in /bin/sh is often designed to be POSIX/UNIX compliant, and so -n is often not supported (FWIW, I'm on macOS 10.14.6 with /bin/sh as bash 3.2.57(1)). You can apparently use "\c" at the end of the thing you are echoing to get "no new line" in a POSIX/UNIC compliant echo (though, that doesn't seem to work with /bin/bash, only /bin/sh ;P).

In file included from /Users/saurik/orchid/cli-shared/vpn/wsk/libgpg-error/src/version.c:28:
./gpg-error.h:1124:1: error: expected external declaration
-n #define GPGRT_LOCK_INITIALIZER {1,{{
^
./gpg-error.h:1124:2: error: unknown type name 'n'
-n #define GPGRT_LOCK_INITIALIZER {1,{{
 ^
./gpg-error.h:1124:4: error: expected identifier or '('
-n #define GPGRT_LOCK_INITIALIZER {1,{{
   ^
3 errors generated.

Event Timeline

gniibe triaged this task as Normal priority.
gniibe added projects: gpgrt, MacOS.

Thank you. I'll fix. Perhaps, I'll ignore old UNIXen like AIX 6.1, which has no way to echo with no newlines.

Well, I didn't know such a use case where a user builds libgpg-error for GNU/Linux on macOS.

iirc the advise from the GNU coding standards is to use printf(1) instead of trying to figure out how echo(1) works.