GNU bug report logs -
#60429
[PATCH 0/5] gnu: yosys: Update to 0.24.
Previous Next
Reported by: Simon South <simon <at> simonsouth.net>
Date: Fri, 30 Dec 2022 15:59:02 UTC
Severity: normal
Tags: patch
Done: Christopher Baines <mail <at> cbaines.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Am Mittwoch, dem 08.02.2023 um 19:35 -0500 schrieb Simon South:
> Yosys' "show" command produces its output by building and executing a
> shell command that invokes "dot" or "xdot" on the user's data. The
> implementation is in passes/cmds/show.cc[0]; the code for invoking
> dot for instance looks like
>
> #define DOT_CMD "dot -T%s '%s' > '%s.new' && mv '%s.new' '%s'"
> (...)
> std::string cmd = stringf(DOT_CMD, format.c_str(),
> dot_file.c_str(), out_file.c_str(), out_file.c_str(),
> out_file.c_str());
> log("Exec: %s\n", cmd.c_str());
> if (run_command(cmd) != 0)
> log_cmd_error("Shell command failed!\n");
>
> Obviously this works only if "dot" is in the user's PATH (as Yosys
> blindly assumes), so the graphviz package must be installed as well
> or the "show" command will be broken. Similarly for the "fuser" and
> "xdot" executables, which by default are invoked to provide graphical
> output (though their use can be overridden by a setting at runtime).
>
> I find this business of generating shell commands a bit ugly but at
> least it creates only a loose coupling between the executables: The
> shell is free to select a suitable "dot" to run, so the user can
> substitute their own as easily as changing their PATH.
When propagating inputs, it creates the same tight coupling as
hardcoding would, but with worse UX (think propagating conflicts).
You should instead try:
std::optional<std::string> dot_bin = which("dot")
if (!dot_bin)
dot_bin = "@dot@";
std::string cmd = string(DOT_CMD, *dot_bin, ...)
Cheers
This bug report was last modified 2 years and 153 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.