Re: strings, change default to -a?

2014-10-25 Thread Theo de Raadt
>> Date: Sat, 25 Oct 2014 13:18:04 +0100
>> From: Stuart Henderson 
>> 
>> http://seclists.org/oss-sec/2014/q4/445
>> 
>> Any thoughts on changing strings(1) to use -a by default, to avoid
>> libbfd parsing, and add a new option to allow previous behaviour for
>> people who want it?
>> 
>> About -a, posix says "Scan files in their entirety. If -a is not
>> specified, it is implementation-defined what portion of each file is
>> scanned for strings."
>> 
>> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/strings.html#tag_20_121_04
>
>Unless upstream makes a similar change, I don't think we should do this.

I agree.  This behavioural change seems too much.  I like my historical
behaviours.



Re: strings, change default to -a?

2014-10-25 Thread Mark Kettenis
> Date: Sat, 25 Oct 2014 13:18:04 +0100
> From: Stuart Henderson 
> 
> http://seclists.org/oss-sec/2014/q4/445
> 
> Any thoughts on changing strings(1) to use -a by default, to avoid
> libbfd parsing, and add a new option to allow previous behaviour for
> people who want it?
> 
> About -a, posix says "Scan files in their entirety. If -a is not
> specified, it is implementation-defined what portion of each file is
> scanned for strings."
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/strings.html#tag_20_121_04

Unless upstream makes a similar change, I don't think we should do this.

> Index: binutils/strings.c
> ===
> RCS file: /cvs/src/gnu/usr.bin/binutils/binutils/strings.c,v
> retrieving revision 1.8
> diff -u -p -r1.8 strings.c
> --- binutils/strings.c31 Aug 2014 13:40:02 -  1.8
> +++ binutils/strings.c25 Oct 2014 12:01:00 -
> @@ -174,17 +174,21 @@ main (int argc, char **argv)
>string_min = -1;
>print_addresses = FALSE;
>print_filenames = FALSE;
> -  datasection_only = TRUE;
> +  datasection_only = FALSE;
>target = NULL;
>encoding = 's';
>  
> -  while ((optc = getopt_long (argc, argv, "afhHn:ot:e:Vv0123456789",
> +  while ((optc = getopt_long (argc, argv, "aAfhHn:ot:e:Vv0123456789",
> long_options, (int *) 0)) != EOF)
>  {
>switch (optc)
>   {
>   case 'a':
> datasection_only = FALSE;
> +   break;
> +
> + case 'A':
> +   datasection_only = TRUE;
> break;
>  
>   case 'f':
> Index: binutils/doc/strings.1
> ===
> RCS file: /cvs/src/gnu/usr.bin/binutils/binutils/doc/strings.1,v
> retrieving revision 1.1.1.2
> diff -u -p -r1.1.1.2 strings.1
> --- binutils/doc/strings.12 Nov 2004 20:22:07 -   1.1.1.2
> +++ binutils/doc/strings.125 Oct 2014 12:01:00 -
> @@ -133,7 +133,7 @@
>  strings \- print the strings of printable characters in files.
>  .SH "SYNOPSIS"
>  .IX Header "SYNOPSIS"
> -strings [\fB\-afov\fR] [\fB\-\fR\fImin-len\fR]
> +strings [\fB\-Aafov\fR] [\fB\-\fR\fImin-len\fR]
>  [\fB\-n\fR \fImin-len\fR] [\fB\-\-bytes=\fR\fImin-len\fR]
>  [\fB\-t\fR \fIradix\fR] [\fB\-\-radix=\fR\fIradix\fR]
>  [\fB\-e\fR \fIencoding\fR] [\fB\-\-encoding=\fR\fIencoding\fR]
> @@ -163,6 +163,10 @@ files.
>  .PD
>  Do not scan only the initialized and loaded sections of object files;
>  scan the whole files.
> +This is the default in this version.
> +.IP "\fB\-A\fR" 4
> +.IX Item "-A"
> +Scan only the initialized and loaded sections of object files.
>  .IP "\fB\-f\fR" 4
>  .IX Item "-f"
>  .PD 0
> 
> 
> 



strings, change default to -a?

2014-10-25 Thread Stuart Henderson
http://seclists.org/oss-sec/2014/q4/445

Any thoughts on changing strings(1) to use -a by default, to avoid
libbfd parsing, and add a new option to allow previous behaviour for
people who want it?

About -a, posix says "Scan files in their entirety. If -a is not
specified, it is implementation-defined what portion of each file is
scanned for strings."

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/strings.html#tag_20_121_04



Index: binutils/strings.c
===
RCS file: /cvs/src/gnu/usr.bin/binutils/binutils/strings.c,v
retrieving revision 1.8
diff -u -p -r1.8 strings.c
--- binutils/strings.c  31 Aug 2014 13:40:02 -  1.8
+++ binutils/strings.c  25 Oct 2014 12:01:00 -
@@ -174,17 +174,21 @@ main (int argc, char **argv)
   string_min = -1;
   print_addresses = FALSE;
   print_filenames = FALSE;
-  datasection_only = TRUE;
+  datasection_only = FALSE;
   target = NULL;
   encoding = 's';
 
-  while ((optc = getopt_long (argc, argv, "afhHn:ot:e:Vv0123456789",
+  while ((optc = getopt_long (argc, argv, "aAfhHn:ot:e:Vv0123456789",
  long_options, (int *) 0)) != EOF)
 {
   switch (optc)
{
case 'a':
  datasection_only = FALSE;
+ break;
+
+   case 'A':
+ datasection_only = TRUE;
  break;
 
case 'f':
Index: binutils/doc/strings.1
===
RCS file: /cvs/src/gnu/usr.bin/binutils/binutils/doc/strings.1,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 strings.1
--- binutils/doc/strings.1  2 Nov 2004 20:22:07 -   1.1.1.2
+++ binutils/doc/strings.1  25 Oct 2014 12:01:00 -
@@ -133,7 +133,7 @@
 strings \- print the strings of printable characters in files.
 .SH "SYNOPSIS"
 .IX Header "SYNOPSIS"
-strings [\fB\-afov\fR] [\fB\-\fR\fImin-len\fR]
+strings [\fB\-Aafov\fR] [\fB\-\fR\fImin-len\fR]
 [\fB\-n\fR \fImin-len\fR] [\fB\-\-bytes=\fR\fImin-len\fR]
 [\fB\-t\fR \fIradix\fR] [\fB\-\-radix=\fR\fIradix\fR]
 [\fB\-e\fR \fIencoding\fR] [\fB\-\-encoding=\fR\fIencoding\fR]
@@ -163,6 +163,10 @@ files.
 .PD
 Do not scan only the initialized and loaded sections of object files;
 scan the whole files.
+This is the default in this version.
+.IP "\fB\-A\fR" 4
+.IX Item "-A"
+Scan only the initialized and loaded sections of object files.
 .IP "\fB\-f\fR" 4
 .IX Item "-f"
 .PD 0