Bug 267221 - [patch] Regression in recently merged file-5.43
Summary: [patch] Regression in recently merged file-5.43
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.3-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: Xin LI
URL:
Keywords: patch-ready, regression
Depends on:
Blocks:
 
Reported: 2022-10-20 08:19 UTC by Eugene Grosbein
Modified: 2022-10-30 19:44 UTC (History)
4 users (show)

See Also:


Attachments
rollback of original commit that introduced the problem (1.47 KB, patch)
2022-10-20 09:37 UTC, Eugene Grosbein
no flags Details | Diff
upstream regression fix (2.96 KB, patch)
2022-10-27 01:58 UTC, Eugene Grosbein
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Grosbein freebsd_committer freebsd_triage 2022-10-20 08:19:26 UTC
This works just fine in file-5.42 (f.e., in FreeBSD 12.3-RELEASE):

(echo /lib/libc.so.7; sleep 3600) | file -bnf -

The commands prints result immediately, as expected. Same command in 12.4-PRERELEASE which has file-5.43 does not print result immediately. This breaks portupgrade, for example.
Comment 1 Eugene Grosbein freebsd_committer freebsd_triage 2022-10-20 09:37:54 UTC
Created attachment 237479 [details]
rollback of original commit that introduced the problem

This patch solved the problem rolling back original commit
https://github.com/file/file/commit/f56746661bec2570e0797d499fa7573cb037c78b
Comment 2 Eugene Grosbein freebsd_committer freebsd_triage 2022-10-20 09:56:44 UTC
The problem reported upstream: https://bugs.astron.com/view.php?id=397
Comment 3 Eugene Grosbein freebsd_committer freebsd_triage 2022-10-20 10:08:49 UTC
Adding re@ to CC: due to upcoming 12.4-RELEASE.
Comment 4 Eugene Grosbein freebsd_committer freebsd_triage 2022-10-20 11:11:35 UTC
(In reply to Eugene Grosbein from comment #1)

Sorry, I pointed to wrong original commit. Correction:
https://github.com/file/file/commit/19bf47777d0002ee884467e45e6ace702e40a4c1
Comment 5 Eugene Grosbein freebsd_committer freebsd_triage 2022-10-26 08:10:58 UTC
Upstream developer is reluctant to fix this regression:
https://bugs.astron.com/view.php?id=397#c3850

A decision needs to made, how should we deal with a problem?
For example, we can follow upstream importing latest commit that introduced new option -I:
https://github.com/file/file/commit/ae5c1ff8df0d6e00cbf5e31875d777edbb88d60a

Then use EXTRA_PATCHES for portupgrade etc. to add -I for invocation of file(1) conditionally, depending on OSVERSION. I do not like this solution so much.

Alternatively, we could use temporary apply the patch attached to this PR that rolls back commit that broke things, as we have not much time for 12.4-RELEASE to wait for this issue to settle.
Comment 6 Eugene Grosbein freebsd_committer freebsd_triage 2022-10-27 01:58:32 UTC
Created attachment 237669 [details]
upstream regression fix

Upstream developer finally issued regression fix in compatible way:
https://github.com/file/file/commit/425f9897f0ed791a6c216c24375bd9b3a42330a2

Here is ready-to-commit patch adapted for our tree.
Comment 7 commit-hook freebsd_committer freebsd_triage 2022-10-27 07:18:55 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=07dfb236c81483c2f08a3976f6d44ce307f4ceaf

commit 07dfb236c81483c2f08a3976f6d44ce307f4ceaf
Merge: 866beaa0aa95 5d5531f83be2
Author:     Xin LI <delphij@FreeBSD.org>
AuthorDate: 2022-10-27 07:12:53 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2022-10-27 07:12:53 +0000

    MFV: Restore the ability to process files from stdin immediately.

    PR:             bin/267221
    MFC after:      3 days

 contrib/file/doc/file.man    |  4 ++--
 contrib/file/src/file.c      | 36 ++++++++++++++++++++++--------------
 contrib/file/src/file_opts.h |  2 +-
 3 files changed, 25 insertions(+), 17 deletions(-)
Comment 8 Fernando Apesteguía freebsd_committer freebsd_triage 2022-10-27 09:07:39 UTC
-I flag has been removed and previous behavior seems to have been restored:

https://bugs.astron.com/view.php?id=397#c3852

Can anyone confirm this?
Comment 9 Eugene Grosbein freebsd_committer freebsd_triage 2022-10-27 10:47:47 UTC
(In reply to Fernando Apesteguía from comment #8)

I can. And you can see the commit noted above
https://github.com/file/file/commit/425f9897f0ed791a6c216c24375bd9b3a42330a2

Or check out the patch attached to this PR, it is same change. It applies to our tree and then "file" works as before breakage.
Comment 10 Fernando Apesteguía freebsd_committer freebsd_triage 2022-10-27 10:55:16 UTC
(In reply to Eugene Grosbein from comment #9)
Thanks, I didn't realize it was the same change.

I'll try to get some of the reporters in bug #266362  and bug #266386 to confirm that works for them and close those PRs.

Thanks.
Comment 11 Eugene Grosbein freebsd_committer freebsd_triage 2022-10-27 11:03:36 UTC
(In reply to Fernando Apesteguía from comment #10)

No need to rush. We can wait until after MFC.
Comment 12 commit-hook freebsd_committer freebsd_triage 2022-10-30 04:42:54 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=14b1657ef3f3a4bf6ddb4df94e17697ecdbccd13

commit 14b1657ef3f3a4bf6ddb4df94e17697ecdbccd13
Author:     Xin LI <delphij@FreeBSD.org>
AuthorDate: 2022-10-27 07:12:53 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2022-10-30 04:41:20 +0000

    MFV: Restore the ability to process files from stdin immediately.

    PR:             bin/267221
    MFC after:      3 days

    (cherry picked from commit 07dfb236c81483c2f08a3976f6d44ce307f4ceaf)

 contrib/file/doc/file.man    |  4 ++--
 contrib/file/src/file.c      | 36 ++++++++++++++++++++++--------------
 contrib/file/src/file_opts.h |  2 +-
 3 files changed, 25 insertions(+), 17 deletions(-)
Comment 13 commit-hook freebsd_committer freebsd_triage 2022-10-30 04:45:56 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=97a6bb4a3f4712ec2d9443f79b6a6e8668ef2b38

commit 97a6bb4a3f4712ec2d9443f79b6a6e8668ef2b38
Author:     Xin LI <delphij@FreeBSD.org>
AuthorDate: 2022-10-27 07:12:53 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2022-10-30 04:42:45 +0000

    MFV: Restore the ability to process files from stdin immediately.

    PR:             bin/267221

    (cherry picked from commit 07dfb236c81483c2f08a3976f6d44ce307f4ceaf)

 contrib/file/doc/file.man    |  4 ++--
 contrib/file/src/file.c      | 36 ++++++++++++++++++++++--------------
 contrib/file/src/file_opts.h |  2 +-
 3 files changed, 25 insertions(+), 17 deletions(-)
Comment 14 Eugene Grosbein freebsd_committer freebsd_triage 2022-10-30 09:56:47 UTC
I'd like to see the fix included in 12.4-RELEASE. Please merge it to releng/12.4.
Comment 15 commit-hook freebsd_committer freebsd_triage 2022-10-30 19:44:16 UTC
A commit in branch releng/12.4 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=28f11883e8d4007f27f6d39f4a95a703bc572da4

commit 28f11883e8d4007f27f6d39f4a95a703bc572da4
Author:     Xin LI <delphij@FreeBSD.org>
AuthorDate: 2022-10-27 07:12:53 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2022-10-30 19:43:13 +0000

    MFV: Restore the ability to process files from stdin immediately.

    PR:             bin/267221
    Approved by:    re (gjb)
    (cherry picked from commit 07dfb236c81483c2f08a3976f6d44ce307f4ceaf)
    (cherry picked from commit 97a6bb4a3f4712ec2d9443f79b6a6e8668ef2b38)

 contrib/file/doc/file.man    |  4 ++--
 contrib/file/src/file.c      | 36 ++++++++++++++++++++++--------------
 contrib/file/src/file_opts.h |  2 +-
 3 files changed, 25 insertions(+), 17 deletions(-)