-
Notifications
You must be signed in to change notification settings - Fork 5
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
For ASCII string values do not leak NULL terminating character, which is a C thing, into perl. #3
Open
glebius
wants to merge
14
commits into
dland:master
Choose a base branch
from
glebius:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Update to support the latest bool type.
glebius
force-pushed
the
master
branch
3 times, most recently
from
March 4, 2021 17:51
a60ceb9
to
fc7e43d
Compare
additional comments.
there are no declarations of sysctl format that start with "T".
- Use the same namespace that sys/sysctl.h uses. - For real types (e.g. string, int, long) use directly values from sys/sysctl.h. Generate bsd-sysctl.ph from sys/sysctl.h. - For structures that we know add more types in the same namespace and valuespace. - In _mib_info() prefer digital kind marker over format string. Parse the format string only for CTLTYPE_OPAQUE in search of known structures. While here: - Include bsd-sysctl.ph into Sysctl.pm during build, a TODO item. - Don't put copyright into generated files. - Add support for CTLTYPE_S32 and CTLTYPE_U32
which is a C thing, into perl. Add a test.
stats and checks that header looks sane.
module-starter does. While here create .gitignore.
The sysctl was removed in c29ba5fe6e3aa26e4fa68b1efa16703b55ac8c05 in 2006. Recently the dead code started to fail to compile. NB: very likely many (or most) of the recognized structures defined in the __DATA__ part of the Makefile.PL are also a dead code.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an old bug in the module that still, I believe, should to be fixed. Of course it can be workaround by unpack("A*", $value) for any string value returned, and many old-timers do that already. However, for any new user this is extremely annoying. Especially since it is virtually impossible to understand what's going wrong from inside one's perl program.
use BSD::Sysctl 'sysctl';
$n = BSD::Sysctl->iterator('kern');
$n->next;
$v = $n->value;
$V = 'FreeBSD';
printf(""%s" is %s to "%s"\n", $v, ($v eq $V) ? 'equal' : 'not equal', $V);