lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190222092956.26cbe722d35202409890bea3@kernel.org>
Date:   Fri, 22 Feb 2019 09:29:56 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Juerg Haefliger <juerg.haefliger@...onical.com>
Cc:     linux-kernel@...r.kernel.org, rostedt@...dmis.org,
        mingo@...hat.com, Juerg Haefliger <juergh@...onical.com>
Subject: Re: [PATCH] selftests/ftrace: Make the coloring POSIX compliant

Hi Juerg,

On Wed, 20 Feb 2019 17:13:33 +0100
Juerg Haefliger <juerg.haefliger@...onical.com> wrote:

> echo -e and \e are not POSIX. Depending on what /bin/sh is, we can get
> incorrect output like:
> $ -e -n [1] Basic trace file check
> $ -e 	[PASS]
> 
> Fix that by using \033 instead of \e and printf.

OK, as far as I can check with checkbashisms, echo -e is not acceptable.

$ checkbashisms ./ftracetest 
possible bashism in ./ftracetest line 176 (echo -e):
  echo -e "$@"
possible bashism in ./ftracetest line 177 (echo -e):
  [ "$LOG_FILE" ] && echo -e "$@" | strip_esc >> $LOG_FILE

So it should be fixed, even other shells support it.
(Or, update checkbashisms command...)

However,

>  prlog() { # messages
> -  echo -e "$@"
> -  [ "$LOG_FILE" ] && echo -e "$@" | strip_esc >> $LOG_FILE
> +  newline="\n"
> +  if [ "$1" = "-n" ] ; then
> +    newline=
> +    shift
> +  fi
> +  printf "$@...wline"
> +  [ "$LOG_FILE" ] && printf "$@...wline" | strip_esc >> $LOG_FILE

This doesn't work when prlog gets several arguments. (like the summary line)
for example I got below result.

# of passed: # of failed: # of unresolved: # of untested: # of unsupported: # of xfailed: # of undefined(test bug): 

Replacing $@ with $* shows correct result. Could you fix it?

Thank you,


-- 
Masami Hiramatsu <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ