Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils: address the deprecated readdir_r function usage #184

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ckhardin
Copy link

@ckhardin ckhardin commented Nov 2, 2018

utils/fs/directory.cpp: In member function ‘void utils::fs::detail::directory_iterator::impl::next()’:
utils/fs/directory.cpp:201:15: error: ‘int readdir_r(DIR*, dirent*, dirent**)’ is deprecated [-Werror=deprecated-declarations]
if (::readdir_r(_dirp, &_dirent, &result) == -1) {
^~~~~~~~~
In file included from utils/fs/directory.cpp:34:
/usr/include/dirent.h:183:12: note: declared here
extern int readdir_r (DIR __restrict __dirp,
^~~~~~~~~
utils/fs/directory.cpp:201:49: error: ‘int readdir_r(DIR
, dirent*, dirent**)’ is deprecated [-Werror=deprecated-declarations]
if (::readdir_r(_dirp, &_dirent, &result) == -1) {
^
In file included from utils/fs/directory.cpp:34:
/usr/include/dirent.h:183:12: note: declared here
extern int readdir_r (DIR __restrict __dirp,
^~~~~~~~~
utils/fs/directory.cpp:201:49: error: ‘int readdir_r(DIR
, dirent*, dirent**)’ is deprecated [-Werror=deprecated-declarations]
if (::readdir_r(_dirp, &_dirent, &result) == -1) {
^
In file included from utils/fs/directory.cpp:34:
/usr/include/dirent.h:183:12: note: declared here
extern int readdir_r (DIR *__restrict __dirp,
^~~~~~~~~
cc1plus: all warnings being treated as errors

utils/fs/directory.cpp: In member function ‘void utils::fs::detail::directory_iterator::impl::next()’:
utils/fs/directory.cpp:201:15: error: ‘int readdir_r(DIR*, dirent*, dirent**)’ is deprecated [-Werror=deprecated-declarations]
         if (::readdir_r(_dirp, &_dirent, &result) == -1) {
               ^~~~~~~~~
In file included from utils/fs/directory.cpp:34:
/usr/include/dirent.h:183:12: note: declared here
 extern int readdir_r (DIR *__restrict __dirp,
            ^~~~~~~~~
utils/fs/directory.cpp:201:49: error: ‘int readdir_r(DIR*, dirent*, dirent**)’ is deprecated [-Werror=deprecated-declarations]
         if (::readdir_r(_dirp, &_dirent, &result) == -1) {
                                                 ^
In file included from utils/fs/directory.cpp:34:
/usr/include/dirent.h:183:12: note: declared here
 extern int readdir_r (DIR *__restrict __dirp,
            ^~~~~~~~~
utils/fs/directory.cpp:201:49: error: ‘int readdir_r(DIR*, dirent*, dirent**)’ is deprecated [-Werror=deprecated-declarations]
         if (::readdir_r(_dirp, &_dirent, &result) == -1) {
                                                 ^
In file included from utils/fs/directory.cpp:34:
/usr/include/dirent.h:183:12: note: declared here
 extern int readdir_r (DIR *__restrict __dirp,
            ^~~~~~~~~
cc1plus: all warnings being treated as errors
Copy link
Member

@jmmv jmmv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the consequences of this change regarding threads? Kyua is currently not threaded, but this would make the directory class not thread-safe, right?


Also, I'll need you to deal with https://cla.developers.google.com/ before I can accept this PR.

Thanks

throw fs::system_error(F("readdir_r(%s) failed") % _path,
original_errno);
}
result = ::readdir(_dirp);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge initialization with definition, which in turn lets you declare the variable as const.

/// Custom representation of the directory entry.
///
/// This is separate from _dirent because this is the type we return to the
/// This is separate from readdir because this is the type we return to the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_dirent used to refer to a specific field. "separate from readdir" now doesn't make a lot of sense. Please reword.

@jmmv
Copy link
Member

jmmv commented Mar 14, 2019

@googlebot rescan

(Mass-triggering a rescan of all open PRs as I have just configured automated CLA checks but the bot won't go through the backlog on its own.)

@googlebot
Copy link
Collaborator

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@ngie-eign
Copy link
Contributor

ngie-eign commented Apr 3, 2019

@ckhardin: is it ok if I pick this review up? I noticed this problem when I was trying to compile kyua on Fedora 29 with g++, so I'd like to make forward progress with the issue that you started working on.

@ckhardin
Copy link
Author

ckhardin commented Apr 3, 2019

@ngie-eign - that's fine, we patched locally with this change to get it going.

@ngie-eign
Copy link
Contributor

@ngie-eign - that's fine, we patched locally with this change to get it going.

When you say, "locally", do you mean Fedora Linux?

@ckhardin
Copy link
Author

ckhardin commented Apr 3, 2019

I signed it!

@googlebot
Copy link
Collaborator

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@ckhardin
Copy link
Author

ckhardin commented Apr 3, 2019

@ngie-eign - no, buildroot - we do an embedded build, so we add patches into buildroot per package to things to compile.

@ngie-eign
Copy link
Contributor

@ngie-eign - no, buildroot - we do an embedded build, so we add patches into buildroot per package to things to compile.

Ah, gotcha.

@ngie-eign
Copy link
Contributor

@googlebot rescan

@ngie-eign
Copy link
Contributor

@googlebot rescan

I guess I can't do that :D.

@ghost ghost mentioned this pull request Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants