Skip to content

factor: trim also null-chars#11182

Merged
cakebaker merged 3 commits intouutils:mainfrom
yotam-medini:fix-bug-11097-factor-nullchar
Mar 4, 2026
Merged

factor: trim also null-chars#11182
cakebaker merged 3 commits intouutils:mainfrom
yotam-medini:fix-bug-11097-factor-nullchar

Conversation

@yotam-medini
Copy link
Contributor

@yotam-medini yotam-medini commented Mar 2, 2026

Closes #11097
In fn write_factors_str() @ factor.rs
trim also null characters.

@oech3

This comment was marked as resolved.

@cakebaker cakebaker changed the title fix bug #11097: factor: trim also null-chars factor: trim also null-chars Mar 3, 2026
@github-actions
Copy link

github-actions bot commented Mar 3, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tty/tty-eof (fails in this run but passes in the 'main' branch)

@cakebaker
Copy link
Contributor

Can you please add a test to tests/by_util/test_factor.rs to ensure we don't regress in the future? Thanks.

@oech3
Copy link
Contributor

oech3 commented Mar 3, 2026

This issue is pipe from stdin specific. Can we add test with our framework?

@cakebaker
Copy link
Contributor

@oech3 I'm not sure I understand your question correctly, but pipe_in should work for this case.

@oech3
Copy link
Contributor

oech3 commented Mar 3, 2026

Thankyou.

@yotam-medini
Copy link
Contributor Author

Do I need to do anything here ?
Does this pull request depends on factor, coreutils: backport 2 GNU tests#11185 ?

@oech3
Copy link
Contributor

oech3 commented Mar 3, 2026

You still need to add Rust native test if possible.

@yotam-medini
Copy link
Contributor Author

Just added:
test_factor.rs += test_trim_null_chars

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

GNU testsuite comparison:

Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/symlink (passes in this run but fails in the 'main' branch)

#[test]
fn test_trim_null_chars() {
new_ucmd!()
.pipe_in_fixture("42_with_null_char.txt")
Copy link
Contributor

Choose a reason for hiding this comment

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

While this works fine, using a fixture is a bit overkill in this case and I would pipe in the input directly:

Suggested change
.pipe_in_fixture("42_with_null_char.txt")
.pipe_in("42\0")

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Note: The gnu test tests/rm/many-dir-entries-vs-OOM is now being skipped but was previously passing.

@cakebaker cakebaker merged commit f52e3e8 into uutils:main Mar 4, 2026
163 checks passed
@cakebaker
Copy link
Contributor

Thanks for your PR!

@oech3
Copy link
Contributor

oech3 commented Mar 4, 2026

Hmm... backported gnu test does not pass.

@yotam-medini
Copy link
Contributor Author

This is my first uutils activity. Please forgive my basic naive questions:

  1. How can I run this gnu test myself locally ?
  2. Will you open a bug for this ? Shall I work on this referring to the same task ?

@oech3
Copy link
Contributor

oech3 commented Mar 4, 2026

It seems new test what I tried to backport has more cases https://github.com/uutils/coreutils/actions/runs/22672349162/job/65719523099?pr=11185#step:8:3223 .

This is the guide to run GnuTests locally, but the doc is incomplete. It lacks some required utils to run it correctly e.g. libacl.

@yotam-medini
Copy link
Contributor Author

@oech3,
I build automake-1.18 from source. Put the executable in my PATH.
apt-get install quilt libacl1-dev .
Still bash util/build-gnu.sh failed with attached log
build-gnu.log

I wish I could help here - but I need an environment that is easier to set.

@oech3
Copy link
Contributor

oech3 commented Mar 4, 2026

It is because GNU 9.10 tarball require too new automake

curl http://launchpadlibrarian.net/831710181/automake_1.18.1-3_all.deb > automake-1.18.deb
sudo dpkg -i --force-depends automake-1.18.deb

which is missing from Ubuntu LTS.

@yotam-medini
Copy link
Contributor Author

The attached
factor-test.py
is derived from gnu/tests/factor/factor.pl
I ignored the error cases.
All 45 positive test ran fine.
So it could be that handling error input is inconsistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

factor: echo -e "3\0" | factor fails

3 participants