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

Message error is missing #24

Open
Diogofornazari opened this issue Jun 23, 2022 · 5 comments
Open

Message error is missing #24

Diogofornazari opened this issue Jun 23, 2022 · 5 comments

Comments

@Diogofornazari
Copy link

Diogofornazari commented Jun 23, 2022

Tool doesn't return error if IP is invalid ( you can put any value, invalid values (zxvf:mlpr9:...) and the return is always 0, like if it was okay); if block 8 is suppressed it doesn't show ip address and it doesn't show any error (abff:0:ed4a:123f:ddd:3e4f:104f::);

Examples
#: netcalc zxvm:lçvd:: && echo Ok
#: Ok

#: netcalc 2fe1:d200:0:0:0:c801:a68:: 64
#: echo $?
#: 0

@Diogofornazari Diogofornazari changed the title Message erro is missing Message error is missing Jun 23, 2022
@abelbeck
Copy link
Contributor

According to netcalc -h

Global options:
  -c          Validate the IPv4/IPv6 address, no output if invalid

So, validating can be performed as:

# test -n "$(netcalc -c 2fe1:d200:0:0:0:c801:a68::)"
# echo $?
1
# test -n "$(netcalc -c 2fe1:d200:0:0:0:c801:a68:0)"
# echo $?
0

I agree a return code would be nice, but IIRC the long history of the netcalc code does not easily lend itself to adding that.

@Diogofornazari
Copy link
Author

Diogofornazari commented Jun 23, 2022 via email

@troglobit
Copy link
Owner

I agree a return code would be nice, but IIRC the long history of the netcalc code does not easily lend itself to adding that.

Well we could change it but anyone scripting with netcalc would possibly start experiencing regressions after upgrading. Making sure the -c option works is imo the least intrusive way forward.

@Diogofornazari
Copy link
Author

Completely agree with You Mr. Wiberg.
I've done some more tests and, even using the -c option, the validation doesn't work well when the 8 block is suppressed.
Totally understand if it's not possible to make changes now, could be a big risk, while that, I'll try to find a way to treat it otherwise.

Thanks for your attention.

@troglobit
Copy link
Owner

@Diogofornazari any help or input on improving -c would be great, thank you for taking the time to report this!

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

No branches or pull requests

3 participants