Re: Update lang/iverilog to 11.0 (fixes no-common)

2021-02-04 Thread Thomas Dettbarn
Hello.

So, I love OpenBSD, and I love icarus verilog. 
Here are my Two Cents:


Within the sources, the file driver/main.c, I found this:

-x-x-x-x-x-x-x-x-x-

#ifndef __MINGW32__
/* First try the location specified in the build process. */
  if (access(IVL_ROOT, F_OK) != -1) {
assert(strlen(IVL_ROOT) < sizeof ivl_root);
strcpy(ivl_root, IVL_ROOT);
return;
  }
#endif
/* If that fails, calculate the ivl_root from the path to the
   command. This is always necessary on Windows because of the
   installation process, but may also be necessary on other OSs
   if the package has been relocated.

-x-x-x-x-x-x-x-x-x-

So, apparently, you can set the directory IVL_ROOT at build time. So the 
port can be salvaged without the need of faking some syscalls() or whatever.

REGARDLESS, I think it is a bad style to set the location of vital libraries 
at build time, without the possibility to change it afterwards.

Maybe somebody should tell Stephen Williams.

Thomas


> Christian Weisgerber  hat am 02.02.2021 23:13 geschrieben:
> 
>  
> Greg Steuck:
> 
> > iverilog still starts.
> 
> But the regression tests fail:
> 
> driver/iverilog -B. -BMvpi -BPivlpp -tcheck -ocheck.vvp ./examples/hello.vl
> Cannot locate IVL modules : couldn't get command path from OS.
> gmake: *** [Makefile:141: check] Error 1
> 
> -- 
> Christian "naddy" Weisgerber  na...@mips.inka.de



Re: Update lang/iverilog to 11.0 (fixes no-common)

2021-02-03 Thread Theo de Raadt
Stuart Henderson  wrote:

> On 2021/02/02 21:18, Greg Steuck wrote:
> > Added a patch from upstream to work around a case of 
> > "all-world-is-Linux"ism.
> 
> That's not really true; pretty much every OS other than OpenBSD has a
> way to determine the path that the current executable was started from.

And in some cases, return a lie, but the application cannot tell that it
has been lied to.

Others spuriously return a "don't know" type error.  And then what do the
applications do?  Well that depends on the application, some carry on fine
because it turns out the path information was less crucial than expected,
others behave incorrectly, others fail.

> There are various different ways of course (there's a little project
> https://github.com/gpakosz/whereami which copes with the variants used
> on qnx, sunos, osx, freebsd, netbsd, linux, android and windows).

By various different ways, you mean the behaviour of the enquiry 

> Suggestions of adding this to OpenBSD have been rejected before,
> I think mostly because it won't track unlink or name changes via rename.

No, that is not why.

It has been rejected because it is IMPOSSIBLE to reverse an inode
to a pathname with an O(1) algorithm.  Furthermore a potential path we
might return is a mix of current-dir-vnode/inode (with path unknown) and
relative-path (which is converted to a new vnode/inode).

Thus, best effort would require storing a relative path (and updating it)
per-vnode.

Ignoring the issue of hard links, we can't actively scan the path heirarchy
(via multiple layers of mounted filesystems) to determine where the inode is,
at request time.

> For the purposes of every program I've seen that uses this information
> (including sshd, which uses argv[0] to obtain it by requiring the
> full path when it's invoked), "path that the process was started
> under" is exactly what they want and tracking through renames would
> not give the information they need.

sshd has an important reason: privsep fork+exec.

Most other programs have far less important reason to do this -- it is
likely some of them come from a authors more familiar with non-Unix
environments where the file-heirarchy isn't constructed from layered
mountpoints with a one-way filename->node mapping.

We could easily have an API which always returns with an incorrect path,
or indicator that we don't know.  After all, on all of the systems listed
about there WILL BE a situation where the path cannot be determined, just
give the applications that error.



Re: Update lang/iverilog to 11.0 (fixes no-common)

2021-02-03 Thread Stuart Henderson
On 2021/02/02 21:18, Greg Steuck wrote:
> Added a patch from upstream to work around a case of "all-world-is-Linux"ism.

That's not really true; pretty much every OS other than OpenBSD has a
way to determine the path that the current executable was started from.
There are various different ways of course (there's a little project
https://github.com/gpakosz/whereami which copes with the variants used
on qnx, sunos, osx, freebsd, netbsd, linux, android and windows).

Suggestions of adding this to OpenBSD have been rejected before,
I think mostly because it won't track unlink or name changes via rename.
For the purposes of every program I've seen that uses this information
(including sshd, which uses argv[0] to obtain it by requiring the
full path when it's invoked), "path that the process was started
under" is exactly what they want and tracking through renames would
not give the information they need.



Re: Update lang/iverilog to 11.0 (fixes no-common)

2021-02-03 Thread Marc Espie
On Tue, Feb 02, 2021 at 09:18:53PM -0800, Greg Steuck wrote:
> Christian Weisgerber  writes:
> 
> > Greg Steuck:
> >
> >> iverilog still starts.
> >
> > But the regression tests fail:
> >
> > driver/iverilog -B. -BMvpi -BPivlpp -tcheck -ocheck.vvp ./examples/hello.vl
> > Cannot locate IVL modules : couldn't get command path from OS.
> > gmake: *** [Makefile:141: check] Error 1
> 
> I have plausible deniability: the test passes if the package is
> installed. Truth is, I didn't check `make test`.
> 
> Please see the updated patch which includes an upstream fix that gets
> `make test` to pass (tested on amd64).

Even though your patch is right, reminder: it's perfectly okay to
TEST_DEPENDS on self



Re: Update lang/iverilog to 11.0 (fixes no-common)

2021-02-02 Thread Greg Steuck
Christian Weisgerber  writes:

> Greg Steuck:
>
>> iverilog still starts.
>
> But the regression tests fail:
>
> driver/iverilog -B. -BMvpi -BPivlpp -tcheck -ocheck.vvp ./examples/hello.vl
> Cannot locate IVL modules : couldn't get command path from OS.
> gmake: *** [Makefile:141: check] Error 1

I have plausible deniability: the test passes if the package is
installed. Truth is, I didn't check `make test`.

Please see the updated patch which includes an upstream fix that gets
`make test` to pass (tested on amd64).

>From 7c13fbb65ca242d1832e21b332f695614fe713a9 Mon Sep 17 00:00:00 2001
From: Greg Steuck 
Date: Mon, 1 Feb 2021 20:15:52 -0800
Subject: [PATCH] Update lang/iverilog to 11.0

This allows it to build with CXXFLAGS=-fno-common

Added a patch from upstream to work around a case of "all-world-is-Linux"ism.
---
 lang/iverilog/Makefile|  4 ++--
 lang/iverilog/distinfo|  4 ++--
 lang/iverilog/patches/patch-driver_main_c | 25 +++
 3 files changed, 29 insertions(+), 4 deletions(-)
 create mode 100644 lang/iverilog/patches/patch-driver_main_c

diff --git lang/iverilog/Makefile lang/iverilog/Makefile
index bbe47233bf8..544c327e9bc 100644
--- lang/iverilog/Makefile
+++ lang/iverilog/Makefile
@@ -2,7 +2,7 @@
 
 COMMENT=   Verilog simulation and synthesis tool
 
-V= 10.3
+V= 11.0
 DISTNAME=  verilog-$V
 PKGNAME=   iverilog-$V
 CATEGORIES=lang devel
@@ -12,7 +12,7 @@ HOMEPAGE= http://iverilog.icarus.com/
 # GPLv2+
 PERMIT_PACKAGE=Yes
 
-MASTER_SITES=  ftp://ftp.icarus.com/pub/eda/verilog/v10/
+MASTER_SITES=  ftp://ftp.icarus.com/pub/eda/verilog/v11/
 
 WANTLIB += ${COMPILER_LIBCXX} bz2 c curses m readline z
 
diff --git lang/iverilog/distinfo lang/iverilog/distinfo
index c8b46d726a4..fc16e0e27b1 100644
--- lang/iverilog/distinfo
+++ lang/iverilog/distinfo
@@ -1,2 +1,2 @@
-SHA256 (verilog-10.3.tar.gz) = hr1F5+EtG8h3LDzdOU5oqf7MsqbRSq99rgdztydDaO8=
-SIZE (verilog-10.3.tar.gz) = 1698889
+SHA256 (verilog-11.0.tar.gz) = 1UeFYWtj/mc5lI6ZZ0mWJPKd7VSttX4eAOuJdWemVdU=
+SIZE (verilog-11.0.tar.gz) = 1784307
diff --git lang/iverilog/patches/patch-driver_main_c 
lang/iverilog/patches/patch-driver_main_c
new file mode 100644
index 000..08795fd5522
--- /dev/null
+++ lang/iverilog/patches/patch-driver_main_c
@@ -0,0 +1,25 @@
+$OpenBSD$
+
+Don't exit when ivl_root not found - the user may have supplied it.
+
+When running 'make check' without having an installed copy, find_ivl_root()
+will fail on Unix systems that don't provide /proc/self/exe (e.g. MacOS).
+
+https://github.com/steveicarus/iverilog/commit/56d2d798ecd97c09539e7748997013eddd37ab42
+
+Index: driver/main.c
+--- driver/main.c.orig
 driver/main.c
+@@ -1061,7 +1061,11 @@ static void find_ivl_root(void)
+   find_ivl_root_failed("command path exceeds size of string buffer.");
+   }
+   if (len <= 0) {
+-  find_ivl_root_failed("couldn't get command path from OS.");
++  // We've failed, but we may yet find a -B option on the command 
line.
++  // Use the built-in path so the user sees a sensible error message.
++  assert(strlen(IVL_ROOT) < sizeof ivl_root);
++  strcpy(ivl_root, IVL_ROOT);
++return;
+   }
+   s = strrchr(ivl_root, sep);
+   if (s == 0) {
-- 
2.30.0



Re: Update lang/iverilog to 11.0 (fixes no-common)

2021-02-02 Thread Christian Weisgerber
Greg Steuck:

> iverilog still starts.

But the regression tests fail:

driver/iverilog -B. -BMvpi -BPivlpp -tcheck -ocheck.vvp ./examples/hello.vl
Cannot locate IVL modules : couldn't get command path from OS.
gmake: *** [Makefile:141: check] Error 1

-- 
Christian "naddy" Weisgerber  na...@mips.inka.de



Update lang/iverilog to 11.0 (fixes no-common)

2021-02-01 Thread Greg Steuck
iverilog still starts.

OK?

Subject: [PATCH] Update lang/iverilog to 11.0

This allows it to build with CXXFLAGS=-fno-common
---
 lang/iverilog/Makefile | 4 ++--
 lang/iverilog/distinfo | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git lang/iverilog/Makefile lang/iverilog/Makefile
index bbe47233bf8..544c327e9bc 100644
--- lang/iverilog/Makefile
+++ lang/iverilog/Makefile
@@ -2,7 +2,7 @@
 
 COMMENT=   Verilog simulation and synthesis tool
 
-V= 10.3
+V= 11.0
 DISTNAME=  verilog-$V
 PKGNAME=   iverilog-$V
 CATEGORIES=lang devel
@@ -12,7 +12,7 @@ HOMEPAGE= http://iverilog.icarus.com/
 # GPLv2+
 PERMIT_PACKAGE=Yes
 
-MASTER_SITES=  ftp://ftp.icarus.com/pub/eda/verilog/v10/
+MASTER_SITES=  ftp://ftp.icarus.com/pub/eda/verilog/v11/
 
 WANTLIB += ${COMPILER_LIBCXX} bz2 c curses m readline z
 
diff --git lang/iverilog/distinfo lang/iverilog/distinfo
index c8b46d726a4..fc16e0e27b1 100644
--- lang/iverilog/distinfo
+++ lang/iverilog/distinfo
@@ -1,2 +1,2 @@
-SHA256 (verilog-10.3.tar.gz) = hr1F5+EtG8h3LDzdOU5oqf7MsqbRSq99rgdztydDaO8=
-SIZE (verilog-10.3.tar.gz) = 1698889
+SHA256 (verilog-11.0.tar.gz) = 1UeFYWtj/mc5lI6ZZ0mWJPKd7VSttX4eAOuJdWemVdU=
+SIZE (verilog-11.0.tar.gz) = 1784307
-- 
2.30.0