@@ -106,18 +106,18 @@ source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/
106106
107107# Export the env variables required for subprocesses to find their runfiles.
108108runfiles_export_envvars
109- """
110109
111- script_format_part = """
112110# Determine the path to load libjvm.so from, either relative to the location of
113111# the java binary or to $JAVA_HOME, if set. On OSS-Fuzz, the path is provided in
114112# JVM_LD_LIBRARY_PATH.
115- JAVA_BIN=$("$(rlocation { realpath})" "$(which java)")
116- JAVA_HOME=${{ JAVA_HOME:-${{ JAVA_BIN%/bin/java}} }}
113+ JAVA_BIN=$(python3 -c 'import os, sys; print(os.path. realpath(sys.argv[1]))' "$(which java)")
114+ JAVA_HOME=${JAVA_HOME:-${JAVA_BIN%/bin/java}}
117115# The location of libjvm.so relative to the JDK differs between JDK <= 8 and 9+.
118- JVM_LD_LIBRARY_PATH=${{JVM_LD_LIBRARY_PATH:-"$JAVA_HOME/lib/server:$JAVA_HOME/lib/amd64/server"}}
119- export LD_LIBRARY_PATH=${{LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}}$JVM_LD_LIBRARY_PATH
116+ JVM_LD_LIBRARY_PATH=${JVM_LD_LIBRARY_PATH:-"$JAVA_HOME/lib/server:$JAVA_HOME/lib/amd64/server"}
117+ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$JVM_LD_LIBRARY_PATH
118+ """
120119
120+ script_format_part = """
121121source "$(rlocation {sanitizer_options})"
122122exec "$(rlocation {driver})" \
123123 --agent_path="$(rlocation {agent})" \
@@ -136,7 +136,6 @@ exec "$(rlocation {driver})" \
136136 deploy_jar = runfile_path (ctx , ctx .file .target_deploy_jar ),
137137 driver = runfile_path (ctx , driver ),
138138 native_dirs = ":" .join (native_dirs ),
139- realpath = runfile_path (ctx , ctx .executable ._realpath ),
140139 sanitizer_options = runfile_path (ctx , ctx .file .sanitizer_options ),
141140 )
142141 ctx .actions .write (script , script_content , is_executable = True )
@@ -233,9 +232,6 @@ def _jazzer_fuzz_binary_impl(ctx):
233232
234233 runfiles = runfiles .merge (ctx .runfiles ([ctx .file .sanitizer_options ]))
235234
236- runfiles = runfiles .merge (ctx .runfiles ([ctx .executable ._realpath ]))
237- runfiles = runfiles .merge (ctx .attr ._realpath [DefaultInfo ].default_runfiles )
238-
239235 script = _jazzer_fuzz_binary_script (ctx , native_libs , driver )
240236 return [DefaultInfo (executable = script , runfiles = runfiles )]
241237
@@ -287,12 +283,6 @@ Rule that creates a binary that invokes Jazzer on the specified target.
287283 allow_single_file = [".jar" ],
288284 mandatory = True ,
289285 ),
290- "_realpath" : attr .label (
291- doc = "The realpath util needed by the binary script." ,
292- default = "//fuzzing/tools:realpath" ,
293- executable = True ,
294- cfg = "target" ,
295- ),
296286 "_allowlist_function_transition" : attr .label (
297287 default = "@bazel_tools//tools/allowlists/function_transition_allowlist" ,
298288 ),
0 commit comments