bugfindutils - Bugs: bug #13303, find should filter out...

 
 

bug #13303: find should filter out non-printable characters if outputting to tty

Submitted by:  Andreas Metzler <ametzler>
Submitted on:  Sun 05 Jun 2005 12:02:58 PM UTC  
 
Category: findSeverity: 3 - Normal
Item Group: Wrong resultStatus: Fixed
Privacy: PublicAssigned to: James Youngman <jay>
Originator Name: Vincent LefevreOpen/Closed: Closed
Release: 4.2.20Fixed Release: 4.2.21

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Sat 11 Jan 2014 02:18:14 PM UTC, comment #7:

Bob Proulx suggests that this change may have introduced a POSIX non-compliance.

James Youngman <jay>
Project AdministratorIn charge of this item.
Tue 07 Jun 2005 11:38:11 PM UTC, comment #6:

You can download a release of findutils in which this problem is
fixed from ftp://alpha.gnu.org/gnu/findutils.

The releases on alpha.gnu.org are for testing purposes, so please
take the time to download the release and verify that your
problem has been solved. Once the release has been sufficiently
tested, it can be uploaded to ftp.gnu.org for everybody to use it.

James Youngman <jay>
Project AdministratorIn charge of this item.
Tue 07 Jun 2005 07:40:08 PM UTC, comment #5:

This problem is fixed in the CVS code for findutils.
To resolve your problem, you could either wait for the
next official release of findutils, or check out a copy
of the code from the CVS repository for findutils.

James Youngman <jay>
Project AdministratorIn charge of this item.
Tue 07 Jun 2005 08:10:49 AM UTC, comment #4:

Here is an updated patch which remedies the problem found by 860 Dmitry V. Levin (double output for -fprint). diff -p used :)

James Youngman <jay>
Project AdministratorIn charge of this item.
Mon 06 Jun 2005 08:07:59 PM UTC, comment #3:

I like the idea, but the patch is quite large.
One mistake found so far: the change to pred_fprint() will result to double print.

P.S. Could you please add -p option to "cvs diff" command next time?

Dmitry V. Levin <ldv>
Sun 05 Jun 2005 11:35:46 PM UTC, comment #2:

I propose the attached patch (against current CVS). Please try it out and let me know if you're happy with the result.

The patch affects -print, -fprint, -fprintf, -printf. It does not affect -ok, -okdir or -print0. The -ls and -fls actions already had escaping.

The escape style for -print and friends is different to that used by -ls. This is explained in the documentation, which is also patched. Please let me know how intelligible you find the (updated) documentation.

One could argue that -ok and -okdir should be fixed. It's not immediately obvious what the best way of doing that is.

Thanks.

James Youngman <jay>
Project AdministratorIn charge of this item.
Sun 05 Jun 2005 02:36:37 PM UTC, comment #1:

My first instinct is to follow the behaviour of "ls", which seems sensible. However, I've started a discussion on the bug-findutils mailing list.

James Youngman <jay>
Project AdministratorIn charge of this item.
Sun 05 Jun 2005 12:02:58 PM UTC, original submission:

This is http://bugs.debian.org/311384 reported against the Debian bug tracking system.

----------------------
Vincent Lefevre <vincent@vinc17.org> writes:
The "find" command should filter out non-printable characters when the output stream (stdout or stderr) is attached to a terminal. Otherwise escape sequences may be sent to the terminal, for instance when there are filenames encoded in UTF-8 and the user has ISO-8859 locales. Also

$ touch "test`tput mc0`"
$ find .

will print some data if your terminal supports printing (e.g. xterm, if this support hasn't been disabled by setting printerCommand to an empty string). This is bad for the security/privacy as some malicious user may create such a filename...
----------------------

Afaict dumping non printable characters to the terminal usually is not wanted and should not be default.

Posix says:
-print
The primary shall always evaluate as true; it shall cause
the current pathname to be written to standard output.

so by filtering out these characters (e.g by replacing them with questionmarks or their escapecodes) we would not be following posix to the letter. But do you want to be that strict?
cu andreas

Andreas Metzler <ametzler>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #3063:  escaped-terminal-output-2.patch added by jay (30KiB - text/x-patch - Second proposed patch (replacing the first) against current CVS)
file #3042:  escaped-terminal-output.patch added by jay (28KiB - text/x-patch - Proposed patch (1) against current CVS)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -unavailable- added by jay (Posted a comment)
  • -unavailable- added by ametzler (submitter and BTS)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 11 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 07 Jun 2005 11:38:11 PM UTCjayOpen/ClosedOpen=>Closed
      Fixed ReleaseNone=>4.2.21
    Tue 07 Jun 2005 07:55:29 PM UTCjayDependencies-=>bugs #13325 is dependent
    Tue 07 Jun 2005 07:40:08 PM UTCjayStatusReady For Test=>Fixed
    Tue 07 Jun 2005 08:10:49 AM UTCjayAttached File-=>Added escaped-terminal-output-2.patch, #2579
    Mon 06 Jun 2005 08:07:59 PM UTCldvCarbon-Copy-=>Added ldv
    Sun 05 Jun 2005 11:36:13 PM UTCjayItem GroupNone=>Wrong result
      StatusNone=>Ready For Test
      Assigned toNone=>jay
    Sun 05 Jun 2005 11:35:46 PM UTCjayAttached File-=>Added escaped-terminal-output.patch, #2576
    Sun 05 Jun 2005 12:02:58 PM UTCametzlerCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1