Skip to content

Conversation

@RayOei
Copy link
Collaborator

@RayOei RayOei commented Feb 28, 2025

Solves "Illegal number" #679 error when two directories are rechecked when generated rmlint.sh is executed with the -p parameter before removing.

# Run check
check_for_equality "$1" "$2"; check_return = $?
# Check latest result. Note the directory compare returns text, which would fail this function #679
if [ "$check_return" -ne "0" ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about if ! check_for_equality "$1" "$2"; then ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That is shorter.
I am not a bash guru 😁 but the first is a bit more clear to me that we are checking the return value of the function as the function itself is returning the full stdout of the compare - which is the reason the if failed to begin with as the comparison wasn't comparing the things that were expected.
Result-wise they are the same. Having said that: I did make a mistake when adding and pushing the check_return 😊 It should read check_return=$?. So this needs an update, either way.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do not mention bash :)
This should not be a bash-script but an sh POSIX-compatible script.
Well, it is shorter and it is what b2dc4ac does, which will eventually get merged.
So I think we should use that.

I propose that your PR be merged for 2.10.3 and it will be overwritten by b2dc4ac when merging for 2.11.0

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You make a lot of ground 😁
It seems we are patching stuff that is already patched. Ah well... I fixed my my fix.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not directly related but with testing it bites me that the version has not been updated (e.g. testing with the incorrect executable). Mind if we bump the version to 2.10.3 so it becomes clear what we are working on?
Can make a separate PR for that for clarity, obviously.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems we are patching stuff that is already patched.

Yes, the idea was to use specifically if ! check_for_equality "$1" "$2"; then in your PR so that line will not conflict when merging later.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not directly related but with testing it bites me that the version has not been updated (e.g. testing with the incorrect executable).

Do you get a warning of some sort ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

line will not conflict when merging later.

Ah.. that makes sense 👍

Do you get a warning of some sort ?

Nothing to worry about, just me not working with the exec I just build (and therefore getting confusing results)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nothing to worry about, just me not working with the exec I just build (and therefore getting confusing results)

When you run RM_TS_PRINT_CMD=1 RM_TS_KEEP_TESTDIR=1 nosetests -s tests/test_formatters/test_sh.py to test this PR, it compiles and run rmlint from the repository, not from the system path

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

😁 I was not running the tests but trying to replay an issue report with something I modified to see whether my idea was sound. which told me enough but I was still second-guessing myself. Either way... having a new version after a release is always sound in my book. The current develop/master issue is adding some confusion too, which makes me a bit more cautious than if I were free hacking away on develop. Thanks for #694

@vassilit vassilit linked an issue Mar 3, 2025 that may be closed by this pull request
@RayOei RayOei force-pushed the fix_679_illegal_nummer branch from 23a0926 to 7676a35 Compare March 3, 2025 13:13
@RayOei RayOei force-pushed the fix_679_illegal_nummer branch from 7676a35 to 34ac762 Compare March 3, 2025 16:20
@vassilit vassilit merged commit 28d5881 into sahib:master Mar 3, 2025
1 check passed
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.

check_for_equality uses numeric vs. string compare

2 participants