-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[infra] use $SWITCH_UID if it is defined (fixes #30) #211
Conversation
BTW I'm not 100 happy with variable name. Suggestions are welcome. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a comment.
I don't have good ideas for a better name... May be BUILD_UID
or UID_FOR_BUILD
, BUILDING_UID
, BUILDER_UID
... My fantasy doesn't work today :)
@@ -148,6 +148,7 @@ def build_fuzzers(build_args): | |||
|
|||
command = [ | |||
'docker', 'run', '--rm', '-i', | |||
'-e', 'SWITCH_UID=' + os.getuid(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't os.getuid()
return an integer? If yes, let's do 'SWITCH_UID=%d' % os.getuid()
+ let's use format string on line 154 instead of concatenation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nits.
@@ -41,6 +41,7 @@ Build configuration is performed through following environment variables: | |||
| `$SANITIZER ("address")` | Specifies sanitizer configuration to use. `address` or `undefined`. | |||
| `$SANITIZER_FLAGS` | Specify compiler sanitizer flags directly. Overrides `$SANITIZER`. | |||
| `$COVERAGE_FLAGS` | Specify compiler flags to use for fuzzer feedback coverage. | |||
| `$SWITCH_UID` | User id to use while building fuzzers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BUILD_UID is a better name i think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
BUILD_CMD="bash -x $SRC/build.sh" | ||
if [ -z "${SWITCH_UID+}" ]; then | ||
adduser -u $SWITCH_UID --disabled-password --no-create-home --gecos '' ossfuzz | ||
chown -R ossfuzz /src |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use $SRC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
if [ -z "${SWITCH_UID+}" ]; then | ||
adduser -u $SWITCH_UID --disabled-password --no-create-home --gecos '' ossfuzz | ||
chown -R ossfuzz /src | ||
chown ossfuzz /out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use $OUT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
bash -x $SRC/build.sh | ||
BUILD_CMD="bash -x $SRC/build.sh" | ||
if [ -z "${SWITCH_UID+}" ]; then | ||
adduser -u $SWITCH_UID --disabled-password --no-create-home --gecos '' ossfuzz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/ossfuzz/build-user or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
If #SWITCH_UID is defined, then compile script will create a user with a given UID and switch to it prior to calling project's build.sh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All done. ptal.
@@ -41,6 +41,7 @@ Build configuration is performed through following environment variables: | |||
| `$SANITIZER ("address")` | Specifies sanitizer configuration to use. `address` or `undefined`. | |||
| `$SANITIZER_FLAGS` | Specify compiler sanitizer flags directly. Overrides `$SANITIZER`. | |||
| `$COVERAGE_FLAGS` | Specify compiler flags to use for fuzzer feedback coverage. | |||
| `$SWITCH_UID` | User id to use while building fuzzers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
bash -x $SRC/build.sh | ||
BUILD_CMD="bash -x $SRC/build.sh" | ||
if [ -z "${SWITCH_UID+}" ]; then | ||
adduser -u $SWITCH_UID --disabled-password --no-create-home --gecos '' ossfuzz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
BUILD_CMD="bash -x $SRC/build.sh" | ||
if [ -z "${SWITCH_UID+}" ]; then | ||
adduser -u $SWITCH_UID --disabled-password --no-create-home --gecos '' ossfuzz | ||
chown -R ossfuzz /src |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
if [ -z "${SWITCH_UID+}" ]; then | ||
adduser -u $SWITCH_UID --disabled-password --no-create-home --gecos '' ossfuzz | ||
chown -R ossfuzz /src | ||
chown ossfuzz /out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -148,6 +148,7 @@ def build_fuzzers(build_args): | |||
|
|||
command = [ | |||
'docker', 'run', '--rm', '-i', | |||
'-e', 'SWITCH_UID=' + os.getuid(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
LGTM |
Hi, I upgraded the oss-fuzz-gen project’s OpenAI SDK dependency from version 0.27.8 to version >=1.0.0, in line with OpenAI's official recommendations. This move is motivated by the significant enhancements introduced in version 1.0.0, which OpenAI details [here](openai/openai-python#742). Key improvements include: - A complete rewrite of the library for robustness and error resilience. - Introduction of explicit client instantiation, replacing the global default and offering more flexible SDK interaction. After upgrading to v1.16.2 (the latest available), I tested the integration with my API key and confirmed full functionality. This upgrade aligns oss-fuzz-gen with current best practices and ensures compatibility with future developments in AI technologies. Hope it helps.
If #SWITCH_UID is defined, then compile script will create a user
with a given UID and switch to it prior to calling project's build.sh.