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

ext/fileinfo: softmagic.c has error: expected identifier #10074

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions ext/fileinfo/libmagic/softmagic.c
Expand Up @@ -512,6 +512,7 @@ check_fmt(struct magic_set *ms, const char *fmt)
# if defined(__aiws__) || defined(_AIX)
# define strndup aix_strndup /* aix is broken */
Copy link
Member

Choose a reason for hiding this comment

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

There's no point in defining this just to unset it later. I assume the implementation of strndup should've been in the #else block.

Copy link
Member

@devnexen devnexen Dec 9, 2022

Choose a reason for hiding this comment

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

I ve tried on my old centos 7 instance (which genuinely is old enough for not having its glibc with strndup) and the build passes without error tough. So you re right @iluuu1994 here anyway, it should be in a else block but even simpler I think the whole can be removed, estrndup is used instead anyway it seems what do you think ?

Copy link
Member

Choose a reason for hiding this comment

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

Oh, it's not even used. In that case removing it is definitely preferable.

Copy link
Author

Choose a reason for hiding this comment

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

I just want to fix the compilation problem and make it pass. You have found the root problem. I tried removing the whole definition. Passed perfectly. Therefore, follow-up to your official handling of this issue.

Copy link
Member

@devnexen devnexen Dec 10, 2022

Choose a reason for hiding this comment

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

In the case @midoks still want to pursue this PR, just realised this fileinfo extension relies on patch appliance. In that case, it needs to port changes in here as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Might even be better to provide the patch upstream; we could then update to the new libmagic version.

# endif
#undef strndup
char *strndup(const char *, size_t);

char *
Expand Down