Costa Shulyupin [Tue, 22 Feb 2022 18:58:05 +0000 (20:58 +0200)]
lib/cgraph: use return value of 'fread' in aglasterr
fix warning:
agerror.c: In function ‘aglasterr’:
agerror.c:49:5: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
49 | fread(buf, sizeof(char), len, agerrout);
This code was attempting to avoid dynamic string construction with low numbered
IDs. This is unnecessary when using a modern compiler that understands functions
like `snprintf` as built-ins and can achieve better optimization without this
trick.
Apart from de-duplicating code, this has the effect of making this code thread
safe where it was not before.
Magnus Jacobsson [Sun, 20 Feb 2022 10:10:04 +0000 (11:10 +0100)]
gvc++: include "AGraph.h" instead of <AGraph.h> in GVLayout.h
This makes it possible to use GVLayout.h from the install directory
without the need to specify both "include" and "include/graphviz" as
include directories to the compiler.
Magnus Jacobsson [Sun, 20 Feb 2022 10:08:52 +0000 (11:08 +0100)]
gvc++: include "gvc.h" instead of <gvc.h> in GVContext.h
This makes it possible to use GVContext.h from the install directory
without the need to specify both "include" and "include/graphviz" as
include directories to the compiler.
Towards https://gitlab.com/graphviz/graphviz/-/issues/2196.
Magnus Jacobsson [Sun, 20 Feb 2022 10:03:43 +0000 (11:03 +0100)]
cgraph++: include "cgraph.h" instead of <cgraph.h> in AGraph.h
This makes it possible to use AGraph.h from the install directory
without the need to specify both "include" and "include/graphviz" as
include directories to the compiler.
Towards https://gitlab.com/graphviz/graphviz/-/issues/2196.
Commit 83eea6075b8f4746d632a792b1d1b97c19797acb altered the calling convention
of `errorv`, but failed to take into account that the local variable `s` was
being used for something else prior to its use as the first unpacked parameter.
Following this commit, the first parameter was being discarded as `s` was
overwritten with `error_info.id` or `id`.
tclpkg vgpanecmd: remove acceptance of ambiguous abbreviated commands
`vgpanecmd` accepted abbreviations of commands, e.g. `li` for list. However
these abbreviations were accepted as first match with no disambiguation. So `r`
would always be interpreted as `rotate`, not `remove`. This behavior appears to
be an unintentional side effect of commands being incrementally introduced over
time without this kind of prefix-matching overlap being taken into account,
though this is mostly a guess as all this code was implemented prior to the
first Git commit.
This commit alters the CI tests to now pull OS information from /etc/os-release
instead of from an ad hoc environment variable. This makes test case execution
independent from which/whether environment variables have been exported. The
intent with this is to reduce the likelihood of an issue like that fixed in 50db0c5e8da293d816d8b5c4620f2fa2d311d37a being reintroduced.
Nothing in the build systems define this, but it is also unclear how to use this
debugging support as the psdbg.c support functions seem to be something internal
that was never committed to the repository.
Rob Hart [Tue, 8 Dec 2020 13:01:24 +0000 (05:01 -0800)]
Move maxiter check after the feasible_tree() call.
Edit from Matt: changelog entry and un-xfailed the test case.
Quoting the description of MR !1688 if it ever ends up lost to the sands of
time:
If `nslimit1` is zero, then `rank2` is called with `maxiter=0`. It is likely
the intent here is to at least compute and return an initial feasible solution
(though not running any network simplex iterations).
Gitlab: fixes #1902
Co-authored-by: Matthew Fernandez <matthew.fernandez@gmail.com>
Rob Hart [Tue, 8 Dec 2020 16:29:53 +0000 (08:29 -0800)]
Regression test for issue 1902
Edit from Matt: Added `xfail` marker as I have reordered the commits to put this
test case introduction before its fix, as well as aligning with current Pylint
requirements.
Gitlab: #1902
Co-authored-by: Matthew Fernandez <matthew.fernandez@gmail.com>
As of fe3f9411d2c59b463ab1b64eecfd19f2db55d2fc, Graphviz requires a C99
compiler. C99 guarantees `sqrtf` so even if the “bug” discussed in the original
commit still exists, generating a `sqrtf` call is fine on a C99 toolchain.
work around a bug in GCC: It generates a call to "sqrtf" for "(float)sqrt(d)"
but sqrtf doesn't exist in libm.a.
reported by: Aaron Digulla <digulla@hepe.com>
As of fe3f9411d2c59b463ab1b64eecfd19f2db55d2fc, Graphviz requires a C99
compiler. C99 guarantees `sqrtf` so even if this “bug” still exists, generating
a `sqrtf` call is fine on a C99 toolchain.
CMake: detect and enable extra optional GD features with gdlib-config
This replicates some logic from the Autotools build system, enabling output
formats like `png:gd`. Note that this only enables `png:gd` on CentOS because
other packaging ecosystems do not seem to include `gdlib-config`.
In retrospect, this test case does not make sense in the regular test suite. It
is validating a particular plugin feature is enabled. It is perfectly valid to
build a version of Graphviz without png:gd support, yet it will fail this test
case.
neatogen: replace 'MAXFLOAT' in clamping logic with 'FLT_MAX'
This seems a more accurate definition of what overflow would mean under C99.
Though as far as I can tell, it is not possible to reach this code with negative
values in the array, so the `< 0` check is always false. The `>= FLT_MAX` is
true for both `FLT_MAX` itself as well as positive infinity.
Jobs inheriting from this template were attempting to set `$OS_ID` from the file
OS_ID that did not exist before `install-package.sh` was run. The result was
output in the build log like:
export OS_ID=$( cat OS_ID )
cat: OS_ID: No such file or directory
Somewhat surprisingly, tests were still passing. The reason is that `$OS_ID` is
only accessed in ci/tests.py and on Ubuntu (the platform used for both ctest
jobs) the only `$OS_ID`-based skip is for `mingle`, that is also coincidentally
skipped due to these jobs using the CMake build system where `mingle` is not
build. That is, the mingle check is meant to be skipped on lines 104-108, but
actually ends up skipped on lines 116-122 due to `$OS_ID` being empty.
In future, all of this should be refactored to use a less brittle technique for
asking “what distro are we running on?” When moving to Python 3.10,
`platform.freedesktop_os_release()` would be the obvious candidate.
CI: redirect stderr→stdout on Windows during build
In CI, the Windows environments run ci/build_windows.py to orchestrate
compilation. This is run under PowerShell, which has the surprising behavior of
(1) hiding stderr and (2) considering any output to stderr a signal to abort the
running program. The combined effect of this is that benign CMake logging
statements like:
message(WARNING "hello world")
abruptly terminate compilation with the baffling output:
This behavior appears to be configurable, but it seems simpler to work around
this by avoiding any stderr output. The exit status of any build commands is
sufficient to signal failure.
fix 'dot' test helper failing to encode string input
When asking the `dot` helper function to process a graph from inline input to a
binary output format, the `universal_newlines=True` parameter would not be
passed to the underlying `subprocess.check_output` call, resulting in failure to
encode the input. That is, something like the following:
dot("png:gd", source="digraph { a -> b; }")
would result in:
self = <subprocess.Popen object at 0x7fbb862ae390>
def _communicate(self, input, endtime, orig_timeout):
…
> input_view = memoryview(self._input)
E TypeError: memoryview: a bytes-like object is required, not 'str'
/usr/lib64/python3.6/subprocess.py:1519: TypeError
Note that this problem was latent, as no usage fitting the above scenario
currently exists. Something like this will be introduced in a future commit.
Commit c334e4e81aad15d3092d7c25038a4d2cf1cbff05 altered this step to only
install RPMs necessary for the test suite at the time. However, an upcoming
commit that enables `dot_builtins` causes graphviz-nox-* to depend on
libgvplugin_webp.so.6 that was not being installed. For simplicity, the present
commit reverts c334e4e81aad15d3092d7c25038a4d2cf1cbff05.
Note that this more closely matches the only reasonable way to use the
CI-produced RPMs: install all of them.
An upcoming commit will install the Graphviz R language bindings. These depend
on the `R` package that is not a dependency of any other currently installed
package.
An upcoming commit will install the Graphviz Perl language bindings. These
depend on the `perl` package that is not a dependency of any other currently
installed package.