bugfindutils - Bugs: bug #48314, find -type f matches symlinks in...

 
 

bug #48314: find -type f matches symlinks in armel armhf and mipsel

Submitter:  Andreas Metzler <ametzler>
Submitted:  Sat 25 Jun 2016 10:45:15 AM UTC
   
 
Category:  find Severity:  5 - Blocker
Item Group:  Wrong result Status:  Fixed
Privacy:  Public Assigned to:  berny
Originator Name:  Maximiliano Curia Open/Closed:  Closed
Release:  None Fixed Release:  4.7.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 29 Aug 2019 07:38:14 PM UTC, comment #6: 

this was an inter-release bug.

Bernhard Voelker <berny>
Group administrator
Sat 16 Jul 2016 01:59:39 PM UTC, comment #5: 

The C standard does not guarantee NULL pointers from xzalloc(), but POSIX does:
http://austingroupbugs.net/view.php?id=940

and GNU has relied on that for years, with no real complaints of a compiler/platform mis-handling NULL.

Eric Blake <ericb>
Group administrator
Sat 16 Jul 2016 01:10:43 PM UTC, comment #4: 

One minor nit about the use of xzalloc: it sets the bits to zero, but this is not guaranteed by the C standard to set pointer members to NULL (since NULL is not guaranteed to be all-bits-zero).

James Youngman <jay>
Group administrator
Thu 30 Jun 2016 12:20:58 AM UTC, comment #3: 

Thanks for the report, the detailed analysis and the patches.
As already mentioned this cannot be reproduced on x86_64.
I've adjusted the commit messages of all 3 patches, and - in Maximiliano's patch - additionally removed the now-superfluous
initializations to NULL/false.

Pushing the attached ("48314.patch") soon.

Thanks & have a nice day,
Berny

(file #37629)

Bernhard Voelker <berny>
Group administrator
Sat 25 Jun 2016 10:58:01 AM UTC, comment #2: 

I have been wondering why the testsuite did not detect this and have found that the issue does not show up if -maxdepth is used.

Find attached a trivial two-patch series to detect the bug:

0001-Test-checked-for-features-in-installed-find.patch
find/testsuite/test_type-list.sh ran the find binary installed on the system /usr/bin/fin/find) instead of the just-built version to check find features.

0002-Detect-type-breakage-on-multiple-archs-48314.patch
Extend test_type-list.sh to also run trivial tests on "-type f" and "-type l" without -maxdepth 0.

cu Andreas

(file #37570, file #37571)

Andreas Metzler <ametzler>
Sat 25 Jun 2016 10:49:13 AM UTC, comment #1: 

Hello,

this is https://bugs.debian.org/827724 originally submitted by Maximiliano Curia:
--------------------------
The new version of find has a weird behaviour, at least in the arches: armhf armel and mipsel.
As simple test:

dir=$(mktemp -d)
cd $dir
ln -s a b
find -type f

Shows ./b while it shouldn't.

Interestingly:
$ find -type l
find: Duplicate file type 'l' in the argument list to -type

Both examples work fine in amd64.

I haven't followed the code thoroughly, but it seems that the type is using a
float to hold a bit mask, maybe this is not so well behaved in all arches.

[...]
With the addition of multiple types in one -type option, the args union of the
predicate struct has grown and the new space is not being initialized.
(The initialization of args is done as a args.str = NULL, but args.types is a
bool types[FTYPE_COUNT]; with count being 8, that's 32 bytes vs 4 that are
currently initialized in a 32 bits arch.

Replacing the xmalloc invocation by a xzalloc one "fixes" the issue as it
initializes all of the predicate components.

I'm attaching a patch that does this.
-----------------------------------
This is against GIT head after 6c37ce48a1eb3d1f21a1848cc9c40f2cdb191e88.

(file #37569)

Andreas Metzler <ametzler>
Sat 25 Jun 2016 10:45:15 AM UTC, original submission:  


Andreas Metzler <ametzler>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #37629:  48314.patch added by berny (6KiB - text/x-diff - patch series supposed to be pushed)
file #37570:  0001-Test-checked-for-features-in-installed-find.patch added by ametzler (949B - text/x-diff - Fix/extend test_type-list.sh.)
file #37571:  0002-Detect-type-breakage-on-multiple-archs-48314.patch added by ametzler (1KiB - text/x-diff - Fix/extend test_type-list.sh.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ericb (Posted a comment)
  • -email is unavailable- added by jay (Posted a comment)
  • -email is unavailable- added by berny (Updated the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-08-29 jay Open/ClosedOpen Closed
    2019-08-29 berny Fixed ReleaseNone 4.7.0
    2016-07-05 berny StatusCode Review Fixed
    2016-06-30 berny Attached File- Added 48314.patch, #37629
        Severity3 - Normal 5 - Blocker
        StatusIn Progress Code Review
    2016-06-29 berny StatusNone In Progress
        Assigned toNone berny
    2016-06-25 ametzler Attached File- Added 0001-Test-checked-for-features-in-installed-find.patch, #37570
        Attached File- Added 0002-Detect-type-breakage-on-multiple-archs-48314.patch, #37571
    2016-06-25 ametzler Carbon-CopyRemoved 20807 -
    2016-06-25 ametzler Attached File- Added replace_xmalloc_with_xzalloc.diff, #37569

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code