GNU bug report logs - #28440
fts_info is set to FTS_DP for an Unreadable directory instead of FTS_DNR on s390x

Previous Next

Package: coreutils;

Reported by: Prajakta Bhatekar <prajakta_bhatekar <at> persistent.com>

Date: Wed, 13 Sep 2017 05:28:01 UTC

Severity: normal

Tags: notabug

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Prajakta Bhatekar <prajakta_bhatekar <at> persistent.com>
To: 28440 <at> debbugs.gnu.org
Subject: bug#28440: fts_info is set to FTS_DP for an Unreadable directory instead of FTS_DNR on s390x
Date: Wed, 13 Sep 2017 03:56:00 +0000
[Message part 1 (text/plain, inline)]

I have a piece of code that checks for access to a non-root user to perform a recursive chown operation on a directory with its child directory having 0 permissions(all permission bits set to zero)

It uses the` fts_info` flags of FTSENT structure returned by fts_read().For s390x architecture(big endian), it is seen that the value of fts_info for the unreadable directory is set as 6 (FTS_DP) corresponding to postorder directory instead of 6 (FTS_DNR) which is an Unreadable directory . For x86 architecture (little endian), expected behaviour is observed as fts_info is FTS_DNR.

Architecture: s390x
Version: 8.25-2ubuntu2

Here is the test code


os::mkdir("one/two"));

os::chmod("one/two", 0));

// Recursive chown should now fail to fully recurse due to

// the lack of permission on "one/two".

EXPECT_ERROR(os::chown(uid.get(), gid.get(), "one", true));

EXPECT_ERROR(os::chown(uid.get(), gid.get(), "one/two", true));


I am using fts_info for the above test as shown below

char* path_[] = {const_cast<char*>(path.c_str()), nullptr};



  FTS* tree = ::fts_open(

      path_, FTS_NOCHDIR | FTS_PHYSICAL, nullptr);



  if (tree == nullptr) {

    return ErrnoError();

  }



  FTSENT *node;

  while ((node = ::fts_read(tree)) != nullptr) {

    switch (node->fts_info) {



Best,



Prajakta Bhatekar <prajakta_bhatekar <at> persistent.com>







DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.
[Message part 2 (text/html, inline)]

This bug report was last modified 6 years and 269 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.