Re: correct way to append to search directories for man

2024-08-11 Thread RVP

On Sat, 10 Aug 2024, Will Senn wrote:

I also tried adding a section in /etc/man.conf where all those other 
directories come from:

# Other sections that represent complete man subdirectories.
X11R7   /usr/X11R7/man/
packages    /usr/pkg/man/
local   /usr/local/man/
# mine
share            /usr/local/share/man/



Add it to `_default':

```
$ diff -u /etc/man.conf{.orig,}
--- /etc/man.conf.orig  2024-01-29 23:14:46.0 +
+++ /etc/man.conf   2024-08-11 08:03:26.043097894 +
@@ -38,7 +38,7 @@
 # directory with all of the subdirectories listed for the keyword _subdir.

 # default
-_default   /usr/{share,X11R7,pkg,local}/man/
+_default   /usr/{share,X11R7,pkg,local}/man/ /opt/lynx/share/man/

 # Other sections that represent complete man subdirectories.
 X11R7  /usr/X11R7/man/
$
```

-RVP

Re: sysupgrade (using ftp for fetching) can't follow redirects on nycdn.netbsd.org

2024-08-08 Thread RVP

On Thu, 8 Aug 2024, Greg A. Woods wrote:


Requesting 
https://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-9/latest/i386/binary/sets/base.tgz
Redirected to /pub/NetBSD-daily/netbsd-9/202408050500Z/i386/binary/sets/base.tgz
ftp: Can't lookup 
`/pub/NetBSD-daily/netbsd-9/202408050500Z/i386/binary/sets/base.tgz:ftp': No 
address associated with hostname
ftp: Can't connect or login to host 
`/pub/NetBSD-daily/netbsd-9/202408050500Z/i386/binary/sets/base.tgz:?'

So, is this an ftp(1) bug (or missing feature), or are the redirects on
nycdn.netbsd.org somehow broken?



Fixed in: https://gnats.netbsd.org/57003

-RVP


Re: Is there a navbar for the html manpages?

2024-08-03 Thread RVP

On Sat, 3 Aug 2024, Van Ly wrote:


I see no difference using either

 $ LC_ALL=en_US.UTF-8 xman
 $ LANG=en_US.UTF-8 xman



I think Michael meant to say use the "C" locale :). Then, mandoc will produce
ASCII output:

env LC_ALL=C xman ...

-RVP


Re: Syslog.conf and remote logging from other devices to a NetBSD server

2024-07-31 Thread RVP

On Tue, 30 Jul 2024, xover2...@hush.com wrote:


The addition of that line does not appear to have changed what was happening 
before that line was added. The syslog messages from 192.168.1.200 are still 
being received and are still being appended to /var/log/messages instead of 
/var/log/host1.



OK, can you add the hostname to the IP address. For example if 192.168.1.200
shows up as `host1' in /var/log/messages, do:

!*
+192.168.1.200,host1
*.* /var/log/host1

That seems to do the trick most of the time (except for early boot messages
from the remote machine sent using logger(1), which are still logged to _both_
locations for some reason).

I think this should also work (provided the "from" isn't a literal IP
address!):

!*
+host1
*.* /var/log/host1

But, I think the prev. version is better as it covers both possibilities.

-RVP


Re: HISTFILE support for /bin/sh

2024-07-28 Thread RVP

On Sat, 6 Jul 2024, Robert Elz wrote:


 | Or provide a cmd to write out the history (non-append mode) in the
 | EXIT handler?

I think that will be possible; if HISTAPPEND gets set, the current
history buffer will be flushed to the file immediately - it needs to
be or history order wrt future commands would be broken.   If you
were to set HISTAPPEND=yes in the exit trap, then (assuming HISTFILE is
set of course) the history buffer would be flushed, and of course, by
the time the exit trap is run, no more commands are going to be read,
so (apart from causing the buffer to be flushed) turning HISTAPPEND
on wouldn't do anything else.   You'd want to leave it set to prevent
the shell from writing the history buffer again (destroying your work)
when the shell exits.



OK, so this is working out quite well so far. I have:

# ~/.profile

```
if [ -n "$NETBSD_SHELL" ]
thenexport HISTFILE=$HOME/.sh.hist
export HISTAPPEND=true
export HISTSIZE=10
fi
trap 'suniq.sh "$HISTFILE"' EXIT
```

# ~/bin/suniq.sh

```
#!/bin/sh
#
# Massage NetBSD /bin/sh's history file before running nuniq.awk.

set -eu -o pipefail

F=${1:-$HOME/.sh.hist}
[ -f "$F" ] || exit 0   # no file

H=$(head -n1 "$F")
[ "$H" = _HiStOrY_V2_ ] || exit 0   # nolle pros.

n=$(who | awk -v U="$(id -nu)" '$1==U { n++ } END { print n+0 }')
[ $n -eq 1 ] || exit 0  # not final sess.

T=$(mktemp "$F.XX")
trap '[ -f "$T" ] && rm -f "$T"' EXIT   # clean-up


"$T" (

echo "$H"   # signature
sed -Ee '
# delete 1st line, lines w/ leading blanks.
# remove trailing blanks.
1d
/^(\\040|\\011)/d
s/(\\040|\\011)+\\012$/\\012/
' "$F" | nuniq.awk && mv -f "$T" "$F"
)
```

# ~/bin/nuniq.awk

```
#!/usr/bin/awk -f

{
if ($0 in A)
delete L[A[$0]]
L[NR] = $0
A[$0] = NR
}
END {
for (i = 1; i <= NR; i++)
if (i in L)
print L[i]
}
```

Gets rid of duplicate lines and lines beginning with blanks (just like in
bash). Suggestions for improvement welcome.

-RVP


Re: Syslog.conf and remote logging from other devices to a NetBSD server

2024-07-24 Thread RVP

On Wed, 24 Jul 2024, xover2...@hush.com wrote:


So, based on what I had read in the syslog.conf(5) man page, I appended the 
following to /etc/syslog.conf :

   +192.168.1.200
   *.*/var/log/host1



Can you reset the progname filter as shown in the man-page:

!*  <-- add this line
+192.168.1.200
*.* /var/log/host1

-RVP


Re: HISTFILE support for /bin/sh

2024-07-05 Thread RVP

On Fri, 5 Jul 2024, Robert Elz wrote:


I'm also just using the libedit (editline) history facilities - which is
what sh has always used for its history.   They have supported reading/writing
files for ages, just sh didn't make use of that functionality [...]



Lovely, but, if you can, could you please arrange it so that the
history is written/appended before the EXIT trap handlers are run?
Or provide a cmd to write out the history (non-append mode) in the
EXIT handler?

I have a little script which I run in ~/.bash_logout which "compacts"
~/.bash_history, and I'd like to do the same for ~/.sh_history (or
whatever). bash(1) isn't clear about the order of writing history
vs. running ~/.bash_logout, so I do:

```
c=$(who | awk -vU=$(id -nu) '$1==U { c++ } END { print c }')
if ((c == 1))
thenhistory -a
buniq.sh
fi
```

in ~/.bash_logout. Ie. write the history first, then remove the
duplicate entries.

Thanks,

-RVP


Re: .tgz vs .xz?

2024-07-05 Thread RVP

On Fri, 5 Jul 2024, Ted Spradley wrote:


ftp: Error retrieving file `404 Not Found'
sysupgrade: E: Failed to fetch
https://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-10/latest/evbarm-aarch64/binary/sets/base.tgz

The compression algorithm has apparently changed and sysupgrade hasn't
kept up. Is there a work-around?



Set `ARCHIVE_EXTENSION=tar.xz` in the config. file (sysupgrade.conf?).

-RVP


Re: NetBSD 10 kernel memory leak?

2024-07-03 Thread RVP

On Tue, 2 Jul 2024, xuser wrote:

My NetBSD 10.0 amd64 server says that 511MB of memory are in use after 
running for one week. Without any load.




Do a `top -n'. If most of that 511MB is categorized as `File', then
it's normal. Every morning at 4:15 the /etc/daily script is run.
This does a checksum verification of all the files under /usr/pkg.
(The more files you have under /usr/pkg, the more data will go into
the file-cache.)

/etc/daily does other things which read a lot of data, but, the package
file-checksum verification is the major hog. You can turn it off using:

echo 'check_pkg_signatures=NO' >> /etc/security.conf

-RVP


Re: .bashrc not working in netbsd.

2024-07-01 Thread RVP

On Mon, 1 Jul 2024, xuser wrote:


I compiled bash 5.0 from the source and the .bashrc file does not work.



This should be mentioned in the man-page: by default (ie. unless
you arrange differently) bash only reads ~/.bash_profile (if this
exists--otherwise, it reads ~/.profile) when it is a login shell.
An interactive bash instance only reads ~/.bashrc.

See the INVOCATION section of bash(1) for all the details.

-RVP


Re: strange issues with building ArcticFox - full rebuilds everytime

2024-06-19 Thread RVP

On Tue, 18 Jun 2024, Riccardo Mottola wrote:


RVP wrote:


 OK. I have the cause and a workaround. You can do a proper fix based on
 it:

 It's the NetBSD shell, /bin/sh (and also /bin/ksh). On NetBSD's /bin/sh:

     LINENO RANDOM SECONDS START_TIME ToD

 change every time you do a `set' and so these will be different for every
 run of `mach build'. This is enough to cause a full rebuild. NetBSD's
 /bin/ksh has RANDOM and SECONDS.


Where is this code? mach? make? configure?
Can it be fixed?



I didn't back-track all the way--I stopped when I figured out what was causing
the full rebuild, but, I think, at least, these need to be looked into:

Arctic-Fox-master/python/mozbuild/mozbuild/mozconfig_loader: lines 60 onwards.

Arctic-Fox-master/build/moz.configure/init.configure:329
Arctic-Fox-master/python/mozbuild/mozbuild/mozconfig.py:229

Initialize `shell' from $SHELL instead of using `sh'.

HTH,

-RVP

Re: strange issues with building ArcticFox - full rebuilds everytime

2024-06-18 Thread RVP

On Tue, 18 Jun 2024, Riccardo Mottola wrote:

I had a look at the error, I don't think you have a dependency issue, but 
more of a configuration issue. something is enabled that doesn't build.
ArcticFox has a package so pkgsrc sure has a valid mozconfig and dependency 
list.




Yeah, I boobed this the first time: I ran mach build w/o a .mozconfig. Don't
worry about this. The follow-up mail I sent after this is more interesting.

-RVP


RE: EXT MAIL : log rotation with syslogng on netbsd 10

2024-06-11 Thread RVP

On Tue, 11 Jun 2024, Derrick Lobo wrote:


Anyone knows what could be wrong here.. is there a new logrotate for netbsd 10 
which does not work with syslogng



Installed syslog-ng just now and newsyslog rotated the logs just fine.

I had only to make 2 fairly obvious changes:

1. In /etc/rc.d/syslogng, change the default pidfile name:

```
# pidfile="/var/run/${ngname}.pid"
pidfile="/var/run/syslogd.pid"
```
   (I was too lazy to fix-up /etc/newsyslog.conf for syslog-ng...)


2. Add a `@version: 3.38' directive at the start of the syslog2ng-generated
   /usr/pkg/etc/syslog-ng/syslog-ng.conf file:

```
$ head /usr/pkg/etc/syslog-ng/syslog-ng.conf
@version: 3.38

options { dir_perm(0755); perm(0644); chain_hostnames(no);
  keep_hostname(yes); };

source local {
unix-dgram("/var/run/log");
udp(ip(0.0.0.0) port(514));
internal();
};
$
```

-RVP


Re: strange issues with building ArcticFox - full rebuilds everytime

2024-06-08 Thread RVP

On Fri, 7 Jun 2024, Riccardo Mottola wrote:

I actually executed in an xterm, interrupted after a couple of minutes and 
checked the scrollback - configure is rerun.


This does not happen on linux or FreeBSD.



OK. I have the cause and a workaround. You can do a proper fix based on 
it:


It's the NetBSD shell, /bin/sh (and also /bin/ksh). On NetBSD's /bin/sh:

LINENO RANDOM SECONDS START_TIME ToD

change every time you do a `set' and so these will be different for every
run of `mach build'. This is enough to cause a full rebuild. NetBSD's
/bin/ksh has RANDOM and SECONDS.

FreeBSD's /bin/sh has none of these. The same with dash(1) on Linux. bash(1)
has LINENO RANDOM & SECONDS, but, it _doesn't_ expose it in a `set'. You
have to ask for it explicitly--echo $SECONDS, etc--so `mach build' works
correctly with bash too.

Setting SHELL=/usr/pkg/bin/dash and CONFIG_SHELL=/usr/pkg/bin/dash doesn't
seem to help at all, so the workaround is this:

pkgin -y in dash
cp /usr/pkg/bin/dash ~/bin/sh
env PATH=$HOME/bin:$PATH ./mach build

That causes dash(1) to be used always and everything seems to work without
a full rebuild.

HTH,

-RVP


Re: strange issues with building ArcticFox - full rebuilds everytime

2024-06-07 Thread RVP

On Fri, 7 Jun 2024, Riccardo Mottola wrote:

I actually executed in an xterm, interrupted after a couple of minutes and 
checked the scrollback - configure is rerun.


This does not happen on linux or FreeBSD.



Well, Linux systems usually have bash and a lot of the scripts in Arctic-Fox
hard-code `#!/bin/bash'. And, as for FreeBSD, it's test(1) understands `=='
as a synonym for `='. I noticed this failure too in the error messages.

However, these may not be the issue at all:


Just as an idea, I checked dates:

-rwxr-xr-x  1 multix  users   221 Jun  6 01:24 configure
-rw-r--r--  1 multix  users  1154 Mar  5 01:29 configure.in
-rw-r--r--  1 multix  users  873016 Jun  6 01:25 old-configure
-rw-r--r--  1 multix  users  253669 Jun  6 01:19 old-configure.in

the ".in" files are suspiciously new, as in the previous run. But I didn't 
update them. Comparing to linux, I see they are not touched since the last 
commit to them:

-rwxr-xr-x 1 multix users  221 May 29 16:08 configure
-rw-r--r-- 1 multix users 1154 Feb 19 11:24 configure.in
-rw-r--r-- 1 multix users 874090 May 29 16:08 old-configure
-rw-r--r-- 1 multix users 253669 May 29 15:30 old-configure.in

the checked out repository is the same... Just to be sure, I yanked the build 
dir and retried. no avail.




I tried to compile both the 44.0 release and the latest source, and while the
build didn't get to the compile stage, rerunning `mach build' after it fails
the first time doesn't trigger configure at all on my setup. Error log for
the 2nd run attached (owing probably to some missing dependency which was not
checked for; everything that `mach build' complained about, I installed from
binary packages).

If I do a `mach clobber', then confgure is, of course, re-run on the next
`mach build'.

-RVP

err.log.gz
Description: Arctic-Fox-master build error log.


Re: NetBSD 10.0 installation cd boot hangs

2024-05-30 Thread RVP

On Thu, 30 May 2024, e...@tilde.team wrote:


On Tue, May 28, 2024 at 08:51:00PM +, RVP wrote:


In your BIOS, can switch the drive controller to `AHCI' instead of whatever
it is now (probably IDE)?

-RVP


It is a SATA drive, and no opportunities to change anything regarding
the drive in the BIOS.



Not the drive: change the drive-controller mode if possible. The `ahcisata'
driver should get used here rather than `viaide', I think.

-RVP


Re: strange issues with building ArcticFox - full rebuilds everytime

2024-05-29 Thread RVP

On Tue, 28 May 2024, Riccardo Mottola wrote:

My first guess is that configure is re-run unneeded, leading thus to a major 
recompile.


Any ideas?



You could make the 2nd & 3rd lines of configure this and confirm:

echo >&2 dying...
exit 1

-RVP


Re: NetBSD 10.0 installation cd boot hangs

2024-05-28 Thread RVP

On Thu, 23 May 2024, e...@tilde.team wrote:


[ 301.7983080] waiting for devices: atabus1 atabus2 atabus3
viaide0 channel 1: reset failed for drive 0



In your BIOS, can switch the drive controller to `AHCI' instead of whatever
it is now (probably IDE)?

-RVP


Re: ffmpeg6 drawtext option question

2024-05-28 Thread RVP

On Tue, 28 May 2024, Michael Lowery Wilson wrote:


However, I get the below result instead:

[AVFilterGraph @ 0x7eb5fb57f580] No such filter: 'drawtext'
[vost#0:0/libx264 @ 0x7eb5fb53a500] Error initializing a simple filtergraph
Error opening output file timestamped-recording.mp4.



That error message is correct; there's no `drawtext' filter compiled in:

$ ffmpeg6 -filters 2>&1 | fgrep drawtext
$

Which points toward an issue with the drawtext filter. I have checked and my 
version of ffmpeg6 is compiled with the --enable-libfreetype flag by default, 
which is required for the drawtext filter:


https://ayosec.github.io/ffmpeg-filters-docs/3.3.9/Filters/Video/drawtext.html



According to the current docs. you also need `--enable-libharfbuzz' now:

https://ffmpeg.org/ffmpeg-filters.html#drawtext-1

Can you recompile with libharfbuzz added, then tell the pkgsrc folks if that
works?

-RVP


Re: Bluetooth wheel mouse and X11

2024-05-23 Thread RVP

On Thu, 23 May 2024, jo...@sdf.org wrote:


I confirmed the output is the same with /dev/wsmouse -- no wsmoused or X.

Here is output for 1) some scrolling, 2) left then right button click, and
3) a bunch of moving the mouse around:



So, the mouse actually _is_ generating scroll events when one moves the mouse.
Might need some quirk handling (see btms_fixup_elecom() in 
dev/bluetooth/btms.c).

Let's see what Linux does for this. Can you tell me what the vendor and product
IDs of the mouse are?

For reference, here's what my Logitech G304 connected via its USB dongle (NetBSD
doesn't recognize my Bluetooth controller yet) reports for the same actions:

```
  scroll: -1 (up)
  scroll: -1 (up)
  scroll: -1 (up)
  scroll: 1 (down)
  scroll: 1 (down)
  scroll: 1 (down)
   press: 0
 release: 0
   press: 2
 release: 2
move: -1 (down)
move: -1 (down)
move: -1 (down)
move: -1 (down)
move: -1 (down)
move: -1 (left)
move: -1 (down)
move: -1 (down)
move: 1 (up)
move: -1 (left)
move: -1 (left)
move: -1 (left)
move: -1 (left)
move: -1 (left)
move: -1 (left)
move: -1 (left)
```

-RVP


Re: Bluetooth wheel mouse and X11

2024-05-23 Thread RVP

On Wed, 22 May 2024, Joel wrote:


wsmuxctl -f 0 -l
wsmouse0
wsmouse2



Can you run this program on the console (no X; no wsmoused) and see if it
reports any scroll events when you move the mouse? Run on /dev/wsmouse2
first, then on /dev/wsmouse. Both should report the same type of events, I
think.

-RVP

--- START mousetest.c ---
/**
 * 64-bit systems: hexdump -e '24/1 "%02x " "\n"' /dev/wsmouseN
 * 32-bit systems: hexdump -e '20/1 "%02x " "\n"' /dev/wsmouseN
 */

#include 
#include 
#include 
#include 
#include 
#include 

int
main(int argc, char* argv[])
{
struct wscons_event e[16], *ep;
char* dev;
int fd;

if (argc != 2) {
fprintf(stderr, "Usage: %s mouse-dev\n", getprogname());
exit(EXIT_FAILURE);
}

dev = argv[1];
if ((fd = open(dev, O_RDONLY)) == -1)
err(EXIT_FAILURE, "%s: open failed", dev);

for (;;) {
ssize_t i, n;
if ((n = read(fd, e, sizeof e)) <= 0) {
close(fd);
err(EXIT_FAILURE, "%s: packet read failed", dev);
}
if (n % sizeof(e[0])) {
close(fd);
err(EXIT_FAILURE, "%s: partial packet read", dev);
}
n /= sizeof(e[0]);
for (i = 0, ep = e; i < n; i++, ep++) {
switch (ep->type) {
case WSCONS_EVENT_MOUSE_UP:
printf(" release: %d\n", ep->value);
break;
case WSCONS_EVENT_MOUSE_DOWN:
printf("   press: %d\n", ep->value);
break;
case WSCONS_EVENT_MOUSE_DELTA_X:
printf("move: %d (%s)\n", ep->value, ep->value < 0 ? 
"left" : "right");
break;
case WSCONS_EVENT_MOUSE_DELTA_Y:
printf("move: %d (%s)\n", ep->value, ep->value < 0 ? 
"down" : "up");
break;
case WSCONS_EVENT_MOUSE_ABSOLUTE_X:
printf("   loc X: %d\n", ep->value);
break;
case WSCONS_EVENT_MOUSE_ABSOLUTE_Y:
printf("   loc Y: %d\n", ep->value);
break;
case WSCONS_EVENT_MOUSE_DELTA_Z:
printf("  scroll: %d (%s)\n", ep->value, ep->value < 0 ? 
"up" : "down");
break;
case WSCONS_EVENT_MOUSE_ABSOLUTE_Z:
printf("   loc Z: %d\n", ep->value);
break;
case WSCONS_EVENT_MOUSE_DELTA_W:
printf(" delta-w: %d (%s)\n", ep->value, ep->value < 0 ? 
"left" : "right");
break;
case WSCONS_EVENT_MOUSE_ABSOLUTE_W:
printf("   loc W: %d\n", ep->value);
break;
case WSCONS_EVENT_HSCROLL:
printf("H-scroll: %d\n", ep->value);
break;
case WSCONS_EVENT_VSCROLL:
printf("V-scroll: %d\n", ep->value);
break;
default:
printf("Unknown: %u %d\n", ep->type, ep->value);
break;
}
}
}
return 0;
}
--- END mousetest.c ---


Re: NetBSD 10 and framebuffer consoles setup vs 9.3 (font, multiple...)

2024-05-22 Thread RVP

On Thu, 11 Apr 2024, Riccardo Mottola wrote:

For 4K displays maybe, but on any laptop I have at hand - without prehaps a 
"Retina" or equivalent display, the small font is readable enough and 
actually the more information makes installing, merging files reading dmesg 
much much easier. Up to my HD display on 22" standard font is fine.

Maybe it is just which threshold you consider  "high enough".



On a laptop with a 14" screen and a 1920x1200 display, I find the default
8x16 font unreadable. And, the scrolling is unbearably slow.


 While installing, you can escape into the shell, then do:

 wsconsctl -dw font=Boldface



Will try at the next run - it works in normal boot.
Perhaps an installer option could be also useful? like keyboard setup, 
display setup.




Like Slackware, eh? Sure; plus, sometimes the kernel picks the
wrong font-size for the resolution (presented by DRMKMS, I think--genfb
doesn't seem to have this issue) and the console ends up with less
than 80x25 cells:

https://mail-index.netbsd.org/netbsd-users/2024/05/10/msg031151.html

On Thu, 11 Apr 2024, Staffan Thomén wrote:


RVP wrote:

 and the system will now use the larger font if you have a high enough
 display. Otherwise, you would end up with an unreadable chars. on, say, 4K
 displays.


Surely this should be against the display density? (i.e. DPI)



Well, DPI is tricky ;). I assume you mean the DPI you get from the
max. res. / display size? And, that the max. res. _actually_ covers
the whole screen, edge-to-edge?

That of course means being able to read the DPI from somewhere, but isn't 
that a thing that EDID does?




There's no DPI present in the EDID data, as far as I know (DisplayID
has horiz. and vert. pixel counts which could be used in combination
with the display size values). And, DPI changes based on current
display res., screen orientation, whether the H & V timings are
padded multiples of 8, etc.

-RVP

Re: GENERIC_KASLR Boot Page Fault in 10.0

2024-05-22 Thread RVP

On Fri, 5 Apr 2024, Isaac wrote:


Whether I choose to install the GENERIC_KASLR kernel via the installation menu, or follow 
the steps at https://wiki.netbsd.org/security/kaslr/, the result is the same. The 
installation succeeds, but when booting the kernel it crashes during the "jumping to 
kernel" stage with a page fault. The GENERIC kernel works fine.



I can reproduce this on real HW too. The 9.4 KASLR kernel works with the
/prekern from 10.99.10; the 10.99.10 KASLR kernel fails to boot.

Looks like a regression. Please file a PR for this.

-RVP


Re: Bluetooth wheel mouse and X11

2024-05-21 Thread RVP

On Tue, 21 May 2024, jo...@sdf.org wrote:

Can you describe a few things so that I can understand your setup.

1. The Xorg.0.log indicates that you're running Xorg on a macppc:


X.Org X Server 1.21.1.9
X Protocol Version 11, Revision 0
[   156.997] Current Operating System: NetBSD macppc 10.0 NetBSD 10.0
(MACMINIG4) #7: Sun May 12 15:16:25 PDT 2024
joelp@xxx:/home/joelp/netbsd10-src/obj/sys/arch/macppc/compile/MACMINIG4
macppc



but xinput thinks it's connected to a Wayland server:


xinput list

WARNING: running xinput against an Xwayland server. See the xinput man
page for details.
_ Virtual core pointer  id=2[master pointer  (3)]
_   _ Virtual core XTEST pointerid=4[slave  pointer  (2)]
_   _ xwayland-pointer:19   id=6[slave  pointer  (2)]
_   _ xwayland-relative-pointer:19  id=7[slave  pointer  (2)]
_ Virtual core keyboard id=3[master keyboard (2)]
   _ Virtual core XTEST keyboard   id=5[slave  keyboard (3)]
   _ xwayland-keyboard:19  id=8[slave  keyboard >




Are you connected to the G4 using ssh -X or something?

2. Have you tried these same mice on an amd64 system?

3. Can you post the output of:

wsmuxctl -f 0 -l

   then that of

wsconsctl -am -f /dev/wsmouseN

   on the bluetooth mouse?

-RVP


Re: Bluetooth wheel mouse and X11

2024-05-20 Thread RVP

On Tue, 21 May 2024, jo...@sdf.org wrote:


2. See if it has `Option "EmulateWheel"' and/or `Option
"EmulateWheelButton"'
is set if the input driver is "mouse"?

I tried those options and I could not get this to change the behavior.



Those should, actually, _not_ be set ;-)


When I created an xorg.conf, I used "wsmouse".



I meant the Xorg input driver ("mouse" or "ws" on NetBSD), not the device the
driver is using.

Can you post your Xorg.0.log, that should make things clear.


Oh nice, Iain also suggested xev. I can now confirm that simply moving the
mouse causes multiple events. I noticed that the scroll action on the
mouse does not produce any events.



Hmm. Simply moving the mouse should generate only MotionNotify events; and
using the mouse-wheel only should generate only ButtonPress & ButtonRelease
events, typically button 5 for a down-scroll & button 4 for up-scroll.


MotionNotify event, serial 25, synthetic NO, window 0xa1,
   root 0x3a6, subw 0x0, time 11141293, (171,138), root:(329,315),
   state 0x0, is_hint 0, same_screen YES

ButtonPress event, serial 25, synthetic NO, window 0xa1,
   root 0x3a6, subw 0x0, time 11141293, (171,138), root:(329,315),
   state 0x0, button 5, same_screen YES

ButtonRelease event, serial 25, synthetic NO, window 0xa1,
   root 0x3a6, subw 0x0, time 11141293, (171,138), root:(329,315),
   state 0x1000, button 5, same_screen YES



So, that's both motion and down-scroll buttons.

Can you also show the output of:

xinput list

and,

xinput list-props 


-RVP


Re: Bluetooth wheel mouse and X11

2024-05-20 Thread RVP

On Thu, 16 May 2024, jo...@sdf.org wrote:


When I launch X11, the BT mouse seems to work by simply moving the cursor
around. But once the cursor is over a window, I noticed that the X,Y
motion is also triggering scrolling. It's as if the mouse motion is
generating scroll wheel events.

My USB mouse works perfectly under X (/dev/wsmouse) and the wheel
scrolling works as expected.

I tried various /etc/X11/xorg.conf mouse settings (including ZAxisMapping)
but nothing prevents the weird scrolling.



1. Can you post your xorg.conf and /var/log/Xorg.0.log?

2. See if it has `Option "EmulateWheel"' and/or `Option "EmulateWheelButton"'
   is set if the input driver is "mouse"?

3. Run xev -event mouse > /tmp/xev.log, then a) first move the mouse only, then
   b) use the scroll-wheel only? Post the xev.log file, too.

-RVP


Re: sysint crash

2024-05-10 Thread RVP

On Fri, 10 May 2024, Stephen Medina wrote:


[ 1.014923] genfb0: framebuffer at 0xf100, size 1024x768, depth 32,
stride 4096

and this tells us the resolution of the display.


1024 x 768

[...]


So I have 48 rows and 128 columns, despite the quite low res monitor
used on that console.


I get 24 rows and 64 columns! Too low it seems. Do I need a different monitor?



In some cases, the kernel picks the wrong font size. Try a smaller one:

https://mail-index.netbsd.org/netbsd-users/2024/04/11/msg030909.html

-RVP


Re: Use a wallpaper

2024-04-17 Thread RVP

On Wed, 17 Apr 2024, Todd Gruhn wrote:


How do I put a graphic or wallpaper on there
when I start X11?



/usr/X11R7/bin/xsetwallpaper

Also:

https://mail-index.netbsd.org/tech-x11/2021/12/12/msg002259.html

-RVP


Re: NetBSD 10 and framebuffer consoles setup vs 9.3 (font, multiple...)

2024-04-10 Thread RVP

On Thu, 11 Apr 2024, Riccardo Mottola wrote:

Here I found that enabling fonts helps. To restore the old behavior, I 
explicitely need to set:

setvar  ttyE0   font    Terminus16B-ISO8859-1

apparently otherwise something which looks like 32B seems to be used...



There are 2 fonts compiled into the GENERIC kernel by default:

$ fgrep FONT_ /usr/src/sys/arch/amd64/conf/GENERIC
options FONT_BOLD8x16
options FONT_BOLD16x32
$

and the system will now use the larger font if you have a high enough
display. Otherwise, you would end up with an unreadable chars. on, say, 4K
displays.

While installing, you can escape into the shell, then do:

wsconsctl -dw font=Boldface

then carry on with the installation.


 3) basic console behaves strange. login and shell does work, but if I do
 vi, I cannot navigate, keyboard is mapped wrongly, cursor keys do not
 work... totally crazy. Also certain promts spit out withyout newline, only
 carriage-return. Like it is not behaving as vt100?


This is a very nasty thing. However, now that I have 4 consoles, I notice 
that 1,2,3 work fine, it is console 0 that doesn't work well! But it is 
also... the first one and the only one I had at the beginning.


On 10.0 I notice:
console "/usr/libexec/getty Pc" vt100   off secure
constty "/usr/libexec/getty Pc" vt100   on secure

While on 9.3:
console "/usr/libexec/getty Pc" wsvt25  off secure
constty "/usr/libexec/getty Pc" wsvt25  on secure


notice vt100 vs wsvt25?



Is this mis-behaviour seen always or only if you sudo?

https://mail-index.netbsd.org/pkgsrc-users/2024/03/23/msg039239.html

I see this only when using a recent sudo, and only on constty.

-RVP

Re: Listing X11 grabs with XF86LogGrabInfo

2024-03-26 Thread RVP

On Tue, 26 Mar 2024, tlaro...@kergis.com wrote:


In current (it has been updated very recently) Xorg xorgproto
(https://gitlab.freedesktop.org/xorg/proto/xorgproto), the
Keysyms in include/X11/XF86keysym.h are:

#define XF86XK_LogWindowTree 0x1008fe24  /* print window tree to log   
*/
#define XF86XK_LogGrabInfo   0x1008fe25  /* print all active gra bs to 
log */



Yeah, XF86keysym.h is where I fudged my data for the patches. A commit log
from 2010 says:

```
commit eb023c0f8919e809b8b609e1467b14d20a290aa7
Author: Daniel Stone 
Date:   Tue Jun 15 18:49:43 2010 +0100

Delete now-redundant XKeysymDB

Since XStringToKeysym now supports all the vendor keysyms, just delete
our XKeysymDB, which was incomplete at best, misleading at worst, and
always an annoyance.
```

and, that looks to be true from reading `libX11-1.8.8/src/StrKeysym.c' quickly.
Don't know why it's still needed on NetBSD and why both

XStringToKeysym("XF86LogGrabInfo")
and
XStringToKeysym("XF86_LogGrabInfo")

don't return the same keysym when they should--according to the comments.
They are equivalent on Linux and FreeBSD.

-RVP


Re: Listing X11 grabs with XF86LogGrabInfo

2024-03-25 Thread RVP

On Mon, 25 Mar 2024, Rob Whitlock wrote:


Is there some trick to enabling this functionality



Yes. Try again after applying this patch (and restarting X).

```
--- usr/X11R7/lib/X11/XKeysymDB.orig2024-03-18 22:47:19.0 +
+++ usr/X11R7/lib/X11/XKeysymDB 2024-03-25 21:36:39.970222356 +
@@ -370,6 +370,9 @@
 XF86_ClearGrab :1008FE21
 XF86_Next_VMode:1008FE22
 XF86_Prev_VMode:1008FE23
+XF86LogWindowTree  :1008FE24
+XF86LogGrabInfo:1008FE25
+

 usldead_acute  :10A8
 usldead_grave  :10A9
```

You could also just supply the key-sequence for this directly:

```
$ xdotool key Ctrl+Alt+F11
```


or should I file a problem report?



Yes, with:

```
diff -urN a/xsrc/external/mit/libX11/dist/src/XKeysymDB 
b/xsrc/external/mit/libX11/dist/src/XKeysymDB
--- a/xsrc/external/mit/libX11/dist/src/XKeysymDB   2010-11-28 
07:34:33.0 +
+++ b/xsrc/external/mit/libX11/dist/src/XKeysymDB   2024-03-25 
21:36:39.970222356 +
@@ -370,6 +370,9 @@
 XF86_ClearGrab :1008FE21
 XF86_Next_VMode:1008FE22
 XF86_Prev_VMode:1008FE23
+XF86LogWindowTree  :1008FE24
+XF86LogGrabInfo:1008FE25
+

 usldead_acute  :10A8
 usldead_grave  :10A9
```

Don't ask me why all the other keysyms just above have the extra
`_'.  Going by the dates on that XKeysymDB file, it's rather old,
and things may have changed since then. I also can't find that file
in the tarballs in: https://www.x.org/releases/individual/lib/, but,
I didn't search very hard--you should ask on the tech-x11 ML.

-RVP


Re: Xorg garbage mouse pointer in window edges and corners (NetBSD 10.0_RC3)

2024-02-01 Thread RVP

On Thu, 1 Feb 2024, Ramiro Aceves wrote:


I am not using any xorg.conf file. Ithink I will have to
generate w new one with:

# X -configure

And place in /etc/X11/xorg.conf

then add the option

Option "SWcursor" "on"



You don't need the whole thing; just a fragment like this will do:

```
$ cat /etc/X11/xorg.conf.d/modesetting.conf
Section "Device"
Identifier  "Card0"
Driver  "modesetting"
Option  "SWcursor" "on"
EndSection
$
```

-RVP


Re: Xorg garbage mouse pointer in window edges and corners (NetBSD 10.0_RC3)

2024-02-01 Thread RVP

On Thu, 1 Feb 2024, Ramiro Aceves wrote:


When I place mouse pointer over the edges or corners of xorg windows
to resize them (same XFCE and  CTWM), mouse pointer icon starts to
show garbage drawing until it ends well shaped after 1 or 2 seconds.



If you run the `modesetting` Xorg display-driver, you can try:

Option "SWcursor" "on"

-RVP


Re: Reverse of promoting to root: downgrade root to unprivileged

2024-01-30 Thread RVP

On Tue, 30 Jan 2024, tlaro...@kergis.com wrote:


That something can be written is sure. But I wondered if there was
some attempt of some library (in whatever language) or some utility
that will "fence" a root user, and will, allow, without modifying
existing (say, as an example, using pkgsrc compilation and
installation procedure), to downgrade root for running and, when
hitting the fence (trying to transgress the rights), will consult a
list of commands---may be script lines: "make install"---and then
respawn the part with updated rights if the commands were listed.



Checking for EPERM or EACCESS in a user program (I'm thinking of dtrace
here) or in an intercepting library and then becoming root and retrying
would be pretty hairy in userspace. Simpler to make use of the kernel-
provided features:

1. If you only want to write things as root whilst running as a user,
   you can use mount_umap(8). But, this 1-to-1 remapping won't work
   for pkgsrc, I think, where the installed files can have arbitrary users.

2. Extend secmodel_extensions(9) slightly so that you can do something
   like:

```
#   rvp & xyz are to be elevated.
% sysctl -w security.models.extensions.pantheon.uids=$(id -u rvp),$(id -u xyz)

#   Go!
% sysctl -w security.models.extensions.pantheon.enable=1

#   Kick them out after 1 hour.
% { sleep 3600; sysctl -w security.models.extensions.pantheon.enable=0; } &
% cd /usr/pkgsrc/some/pkg && make install
```


The question arises when I asked (wanting to write something for my
own): OK, but _what_ unprivileged user exists that I can safely "su"
to and accomplish the unprivileged part as? "nobody" does not seem the
answer; "operator" neither. This opened a can of worm-questions ;-)



I have a `bld' user for this.

-RVP


Re: Reverse of promoting to root: downgrade root to unprivileged

2024-01-29 Thread RVP

On Sat, 27 Jan 2024, tlaro...@kergis.com wrote:


But does somebody know of an established program or library that allows
to start a process as root and to automatically downgrade rights for
tasks (I mean identified chunks of whatever code) that do not require
privileges?



You mean toggling between various EUIDs and the saved-SUID? That's
pretty standard stuff, but, I don't know if it's been encapsulated
in any kind of utility.

-RVP


Re: xterm -fa weirdness (9.3 and 10.0 RC_1)

2024-01-05 Thread RVP

On Fri, 5 Jan 2024, Rhialto wrote:


The thing is that I used the lower case names (instance names instead of
class names) in the .Xresources on purpose. The reason was, if I
remember correctly, to make them work for both xterm and uxterm.



A change like this should work for that use-case, I think:

xterm*faceName:   Lucida Console Semi-Condensed
xterm*faceSize:   9

Use an instance-name, but, make it very general. Then `-fa something'
will override the above because it supplies the component which will
win over the *.

HTH,

-RVP


Re: xterm -fa weirdness (9.3 and 10.0 RC_1)

2024-01-05 Thread RVP

On Thu, 4 Jan 2024, Rhialto wrote:


I do have in my ~/.Xresources:

xterm.vt100.faceName:   Lucida Console Semi-Condensed
xterm.vt100.faceSize:   9
XTerm.vt100.renderFont: false
UXTerm.vt100.renderFont:true



You've put the instance-names (lower-case initial char.) in .Xresources
which will override resources specified using class-names (upper-case
initial char.), so:


This works:

xterm -xrm "xterm.vt100.renderFont: true" \
 -xrm "xterm.vt100.faceSize: 12" \
 -xrm "xterm.vt100.faceName: C64 Pro Mono"

This should be equivalent, and in fact the preferred way (when specifying
the font specifically on the command line), but doesn't work:

xterm -xrm "xterm.vt100.renderFont: true" \
 -xrm "xterm.vt100.faceSize: 12" \
 -fa "C64 Pro Mono"



those 2 are not equivalent. The `-fa "C64 Pro Mono"' becomes, I believe,
`XTerm.VT100.faceName: C64 Pro Mono'; and class-names are a less specific
match compared to instance-names. This is hinted at in xterm(1):

Some poorly‐designed resource files are too specific to
allow the command‐line options to affect the relevant widget
values.

and more fully (though, opaquely) explained in X(7), sec. RESOURCES:

The rules (in order of precedence) are:

1.   An entry that contains a matching component (whether
name, class, or "?")  takes precedence over entries that
elide the level (that is, entries that match the level in
a loose binding).

2.   An  entry with a matching name takes precedence over
both entries with a matching class and entries that match
using "?".  An entry with a matching class takes precedence
over entries that match using "?".

3.   An entry preceded by a tight binding takes precedence
over entries preceded by a loose binding.

#2 and #3 are, I think, what apply here. Use the class-name in .Xresources:

```
--- .Xresources.orig2024-01-05 07:50:56.289131905 +
+++ .Xresources 2024-01-05 07:51:36.842215151 +
@@ -1,4 +1,4 @@
-xterm.vt100.faceName:   Lucida Console Semi-Condensed
-xterm.vt100.faceSize:   9
+XTerm.vt100.faceName:   Lucida Console Semi-Condensed
+XTerm.vt100.faceSize:   9
 XTerm.vt100.renderFont: false
 UXTerm.vt100.renderFont:true
```

That should work.

-RVP

Re: Hangs when trying to read a NTFS disk with 3g (No buffer space?)

2023-12-27 Thread RVP

On Tue, 28 Nov 2023, Riccardo Mottola wrote:


Hi!

I installed fuse-ntfs-3g-2022.10.3 to read&write on an external HD.

I did this on an i386 laptop and an amd64 one, to double check.. and
because I need it on both!

I try to read this disk
[  7080.368720] sd0 at scsibus0 target 0 lun 0:  
disk fixed
[  7080.378727] sd0: fabricating a geometry
[  7080.378727] sd0: 1397 GB, 1430799 cyl, 64 head, 32 sec, 512 bytes/sect x 
2930277168 sectors
[  7080.388733] sd0: fabricating a geometry

I mount the disk this way and get the following messages:

isengard$ sudo mount.ntfs-3g /dev/sd0e /mnt
mount.ntfs-3g: perfuse_open: setsockopt SO_SNDBUF to 2162688 failed: No
buffer space available
mount.ntfs-3g: perfuse_open: setsockopt SO_RCVBUF to 2162688 failed: No
buffer space available
mount.ntfs-3g: perfuse_open: setsockopt SO_SNDBUF to 2162688 failed: No
buffer space available
mount.ntfs-3g: perfuse_open: setsockopt SO_RCVBUF to 2162688 failed: No
buffer space available
mount.ntfs-3g: perfuse_open: setsockopt SO_SNDBUF to 2162688 failed: No
buffer space available
mount.ntfs-3g: perfuse_open: setsockopt SO_RCVBUF to 2162688 failed: No
buffer space available

A quick check with "ls /mnt" shows the expected directories, but if I
try to read into a subdirectory, I get a hang.
In one attempt, the system did hang, I could not kill applications, only
a (soft) power-down helped.
Right now I could quit with crl-c,  I see that I can't list several
first-level directories, but some *do* work. I tried to copy some
files... I get a hang. After a second attempt I get a hang I cannot
ctrl-c. I see no output nor dmesg with a clue.

Ideas? Experiences with 3f NTFS?



Did you try the workaround from MESSAGE.NetBSD? (which should've been displayed
when you installed the package):

```
Make sure the PERFUSE_BUFSIZE is lowered for NTFS:

env PERFUSE_BUFSIZE=135168 ntfs-3g /dev/dk1 /mnt
```

-RVP


Re: vim hangs (slows) intermittently in mlterm on some UTF8 files

2023-12-27 Thread RVP

On Thu, 14 Dec 2023, Mayuresh wrote:


However, the fact remains that, if I use mlterm on a NetBSD VM there is no
issue even on a large screen. The issue is only when using mlterm on
Linux. Might have something to do with the OS' libraries and differences
in their handling of the terminal.



Since this is on Linux, you could try strace(1) or ltrace(1):

strace -rT -o /tmp/mlterm.log mlterm ...

Then, look at the 1st and last fields for anomalies (disregarding things
like read(), select(), poll()--which usually take some time to complete).

-RVP


Re: rc.local nightmare

2023-10-29 Thread RVP

On Sun, 29 Oct 2023, Ramiro Aceves wrote:


if [ -x /root/nettest ]; then
/root/nettest &
fi



Redirect the output of your script somewhere and then it shoould be OK:

```
if [ -x /root/nettest ]; then
/root/nettest >/root/nettest.log 2>&1 &
fi
```

(Or, use logger(1) on all output within the script.)

What's happening here can be understood if you look at the 2nd last
line of /etc/rc which is:

```
rc_real_work "$@" 2>&1 | rc_postprocess
```

The rc_real_work() function runs all the rc scripts in /etc/rc.d/
including /etc/rc.local (via /etc/rc.d/local), and _all_ output is,
as you can see, piped to rc_postprocess()

When all the scripts finish, /etc/rc exits, and so does the RHS of
that pipeline ie. whatever's running rc_postprocess(). So, anything
started by rc_real_work() will get a SIGPIPE as soon as it tries
to write stuff to its stdout/stderr.

The nohup command also didn't work for the same reason. The nohup
man-page says:

If the standard output is a terminal, the standard output
is appended to the file nohup.out in the current directory.
If standard error is a terminal, it is directed to the same
place as the standard output.

Well, here the output of _all_ the scripts is a pipe, so nohup
doesn't redirect the output of your command into a nohup.out file
and here too it gets a SIGPIPE.

HTH,

-RVP


Re: NetBSD 9.3 amd64 Intel Nuc 8i7BEH xorg problem

2023-10-07 Thread RVP

On Sat, 7 Oct 2023, Ramiro Aceves wrote:

Just to be sure before breaking everyting ;-), is this right procedure to 
upgrade as The NetBSD Guide says?


"When upgrading between major releases (e.g. between NetBSD 8.2 and 9.2), 
take care to first upgrade the kernel and modules:


#  sysupgrade fetch https://cdn.NetBSD.org/pub/NetBSD/NetBSD-9.2/amd64
#  sysupgrade kernel
#  sysupgrade modules
#  reboot
#  sysupgrade sets
#  sysupgrade etcupdate
#  sysupgrade postinstall
#  sysupgrade clean
#  reboot

"



Yes, that's the correct procedure, but, I've never tried an update like
that using `sysupgrade'--I generally do a fresh install from scratch.

And, unless you're fine with compiling your applications from source, I
would hold off on the upgrade until the binary packages for 10.x arrive:

https://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/


 but changing the URL to this?:

 http://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-10/latest/

 Thank so much.


sorry, this one:

http://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-10/202310051300Z/amd64/



Use the URL with `latest' in it.

-RVP


Re: NetBSD 9.3 amd64 Intel Nuc 8i7BEH xorg problem

2023-10-07 Thread RVP

On Fri, 6 Oct 2023, Ramiro Aceves wrote:

I do not know if I am doing something wrong or NetBSD 9.3 simply cannot work 
properly with the Iris Plus 655 Intel Graphics card of the Nuc.




The DRMKMS driver in 9.x doesn't support Iris Plus 655 i.e Coffee Lake cards.
See: https://wiki.netbsd.org/laptops/ (section: Graphics)
Try the latest 10-BETA.

-RVP


Re: vdpau setup

2023-09-25 Thread RVP

On Mon, 25 Sep 2023, Rhialto wrote:


I found, at some point, that for my radeon card I needed to set

# For mpv --vo=vdpau
# See libvdpau/dist/src/vdpau_wrapper.c
export VDPAU_DRIVER=radeonsi
export VDPAU_DRIVER_PATH=/usr/pkg/lib/vdpau/

but I commented it out again, so I gather it wasn't worth the trouble.



+1. But, that won't help in this case though because:

a) libvdpau_nouveau.so isn't being built.
b) even if it were, HW video decoding wouldn't work on nouveau
   because you need firmware blobs:

https://bugzilla.redhat.com/show_bug.cgi?id=1731877 
https://nouveau.freedesktop.org/VideoAcceleration.html


-RVP


Re: Console video resolution

2023-09-25 Thread RVP

On Thu, 21 Sep 2023, Brook Milligan wrote:


Is there a way to control the video resolution on the console of a NetBSD 
machine?  Is that controlled by the kernel somehow?



You generally do this in the bootloader and then it's useful only
for genfb.  The `gop' (for UEFI boot) or `vesa' (for legacy boot)
will work (on x86, at least).

Once the DRMKMS driver takes over, it will choose the highest resolution
supported by your HW. Here, you could try changing the resolution using
the DRM api: xsrc/external/mit/libdrm/dist/tests/modetest/ looks like a
promising subject to gut...

-RVP


Re: vdpau setup

2023-09-25 Thread RVP

On Sun, 24 Sep 2023, Sergio de Almeida Lenzi wrote:


Now I need to make the system use the vdpau being used by the system
using the nouveau driver...



This should automatically be the case. In mpv(1), if your CPU/GPU can do
HW decoding, a `I' (capital I) will indicate this. You can also toggle
HW-decoding on and off using Ctrl-H.

-RVP


Re: Meaning of size of /dev/pts/ files

2023-09-25 Thread RVP

On Mon, 25 Sep 2023, rockyho...@firemail.cc wrote:


The /dev/pts/ files seem to have each their own size, as if they were
regular files. First curious fact: `ls -l' doesn't show the size in
bytes of such files (for some reason).

crw--w  1 rockyhotas tty  5, 129 Sep 24 21:44 129
crw--w  1 rockyhotas tty  5, 154 Sep 25 07:27 154
crw--w  1 rockyhotas tty  5, 160 Sep 25 07:24 160
crw--w  1 rockyhotas tty  5, 174 Sep 24 21:14 174
crw--w  1 rockyhotas tty  5, 175 Sep 25 07:27 175

(columns are: permissions, number of hard links, user owner, group owner,
major number, minor number, last modified date, filename)



Device special files don't have a size as you yourself point out, so


Instead, `exa' shows their sizes:

crw--w  5,174 rockyhotas24 Sep 21:14  174
crw--w  5,129 rockyhotas24 Sep 21:44  129
crw--w  5,160 rockyhotas25 Sep 07:24  160
crw--w  5,175 rockyhotas25 Sep 07:27  175
crw--w  5,154 rockyhotas25 Sep 07:27  154

(columns are: permissions, size, user owner, last modified date, filename)



The second column is actually major,minor nos. You can verify this by
correlating the filenames in the ls -l output.

Do a `stat -x /dev/pts/...' and you should see a size of 0 for all of these.

-RVP


Re: [IPv6] Something I don't understand

2023-09-09 Thread RVP

On Fri, 8 Sep 2023, BERTRAND Joël wrote:


Now, both Linux and NetBSD can send and receive IPv6 packets but
workstations on LAN cannot use IPv6 through NetBSD server.



OK, so both legendre and rayleigh can ping6 the outside world?


as my ISP routes PREFIX:a00::/56 network

When I try a ping6 www.google.fr from LAN, NetBSD's wan interface sends:

09:38:32.261784 IP6 PREFIX:a10:d65d:64ff:feb4:9a3b >
par10s21-in-x03.1e100.net: ICMP6, echo request, seq 1, length 64
09:38:33.277892 IP6 PREFIX:a10:d65d:64ff:feb4:9a3b >
par10s21-in-x03.1e100.net: ICMP6, echo request, seq 2, length 64



So, if ICMP packets from the LAN are going out of your gateway
machine to the ISP, I would say your internal routing is fine. You
should've seen a reply because now the sending of those ICMP packets
and the routing of the replies are your ISPs responsibility. Your
part is done.


I suppose NetBSD cannot route ICMP6 answer as www.google.fr sends its
answer to PREFIX:a10:d65d:64ff:feb4:9a3b and WAN address is
PREFIX:a00::/64 (PREFIX:a10::/64 is only on LAN side).



PREFIX:a00::/56 is "wider" than PREFIX:a00::/64 or PREFIX:a10::/64,
and since your ISP will (or should!) send all packets destined for
PREFIX:a00::/56 to legendre, ICMP replies to requests from LAN
hosts should also be seen on wm2.


How can I configure WAN interface to accept IPv6 packets for LAN ?



You can't--your ISP should routing this (ie. the whole of
PREFIX:a00::/56) for you.

You say only legendre and rayleigh work OK. Can you do this:

Install a ping app on your smartphone. Then ping legendre, rayleigh
and some other machines on the LAN (make sure to use the cellular
network rather than your local WiFi connection!). Do a tcpdump on
legendre/wm3. See what packets arrive and which doesn't. Also try
out a bunch of IPv6 addresses in the range assigned to you, even
if they're not assigned to any of your machines. You should see
all of them on the gateway machine.

-RVP

Re: [IPv6] Something I don't understand

2023-09-08 Thread RVP

On Thu, 7 Sep 2023, BERTRAND Joël wrote:


But from LAN, IPv6 public network is unreachable. For example:
hilbert:[~] > ping6 www.google.fr
PING www.google.fr(par10s39-in-x03.1e100.net (2a00:1450:4007:807::2003))
56 data bytes

On legendre (NetBSD server), tcpdump on wm2 (public interface) shows:
legendre# tcpdump -i wm2 -p ip6
09:28:19.696443 IP6 PREFIX:a10:d65d:64ff:feb4:9a3b >
par10s39-in-x03.1e100.net: ICMP6, echo request, seq 16, length 64
09:28:20.720469 IP6 PREFIX:a10:d65d:64ff:feb4:9a3b >
par10s39-in-x03.1e100.net: ICMP6, echo request, seq 17, length 64

Thus, icmp packets received from lan side are sent to public interface,
but there is no answer.



Maybe it's an ISP issue? Can you ping your machines from the outside using, say,
an SDF.org account? Check if packets arrive on wm2 on legendre when you do
this.

-RVP

Re: segfault in libterminfo with ncurses with nethack

2023-09-04 Thread RVP

On Sat, 2 Sep 2023, Rhialto wrote:


The current variant which I have committed reads (comments stripped)

USE_NCURSES=yes
.include "../../mk/curses.buildlink3.mk"
.  if "${CURSES_TYPE}" != "ncurses"
.include "../../mk/termcap.buildlink3.mk"
.  endif
[...]

I switched to USE_NCURSES because pkglint says not to set PREFER.curses
in the package.

Testing with the other curses can be done by defanging the line
"USE_NCURSES=yes". So far I haven't been able to create a smaller test
case.



Should mk/curses.buildlink3.mk be used like this at all? The first para. in
that file states:

```
# This Makefile fragment is meant to be included by packages that require
# any curses implementation instead of one particular one.  The available
# curses implementations are "curses" if built-in, "ncurses", and
# "pdcurses".
#
# If a package genuinely requires ncurses or pdcurses, then it should
# directly include the appropriate buildlink3.mk instead of this file in
# the package Makefile.
```

That seems sensible. And, the next para. is:

```
# User-settable variables:
#
# CURSES_DEFAULT
#   This value represents the type of curses we wish to use on the
#   system.  Setting this to "curses" means that the system curses
#   implementation is fine.
#
#   Possible: curses, ncurses, ncursesw, pdcurses
#   Default: (depends)
```

So, if you use mk/curses.buildlink3.mk, one should set CURSES_DEFAULT=ncursesw
to compile with ncursesw.

-RVP


Re: /dev/tty01 will not open on Beaglebone Black

2023-09-03 Thread RVP

On Sun, 3 Sep 2023, Brook Milligan wrote:


Is there a reason not to commit this?



If the ARM gurus are OK with it, then please do.

-RVP


Re: segfault in libterminfo with ncurses with nethack

2023-09-03 Thread RVP

On Sun, 3 Sep 2023, Robert Elz wrote:


Wouldn't it be better to just delete the include of the termcap
buildlink file entirely?



Yes.


That is unless the application is actyally using termcap functionality
directly itself.



You could omit it even then (here) because both ncurses and pdcurses implement
both the termcap (tget*) and the terminfo (tiget*) functions.


If the only reason it is there is because the NetBSD curses requires it,
surely the curses buildlink file should be adding it, when it is
needed (and not otherwise).



Yes!

-RVP


Re: /dev/tty01 will not open on Beaglebone Black

2023-09-02 Thread RVP

On Thu, 31 Aug 2023, Brook Milligan wrote:


I have attached the test program below, and would appreciate more eyes on it  
[...]



That looks OK apart from a few minor issues:

- If you want to turn off non-blocking, use the standard idiom instead of
  fcntl(fd,F_SETFL,0):

int flg = fcntl(fd, F_GETFL, 0);
fcntl(fd, F_SETFL, flg & ~O_NONBLOCK);

- Call cfmakeraw() _before_ changing settings (not after) because it modifies
  some bits (eg. CS8, ~PARENB) itself (see: src/lib/libc/termios/cfmakeraw.c)


However, a write fails and hangs the board hard: no keyboard response, no 
response to pings.



As the others have said, this looks like a kernel issue. Apropos which: from
your `am335x-boneblack-comm_cape.dts' file:

```
&am33xx_pinmux {
bborg_comms_rs485_pins: pinmux_comms_rs485_pins {
pinctrl-single,pins = <
0x074 (PIN_OUTPUT | MUX_MODE6)  /* P9_13: 
gpmc_wpn.uart4_txd_mux2 */
0x070 (PIN_INPUT  | MUX_MODE6)  /* P9_11: 
gpmc_wait0.uart4_rxd_mux2 */
>;
};
};
```

Is that `RS-485' there correct? Shouldn't it be UART or RS-232 or something?

Following the links for the Comms cape from beagleboard.org, I landed here:

https://elinux.org/Beagleboard:BeagleBone_cape_interface_spec#UART

where the `BONE-UART4.dts' has this:

```
&ocp {
P9_13_pinmux { pinctrl-0 = <&P9_13_uart_pin>; };/* UART TX*/
P9_11_pinmux { pinctrl-0 = <&P9_11_uart_pin>; };/* UART RX*/
};

&bone_uart_4 {
status = "okay";
};
```

There is also the `BB-UART4-00A0.dts' file here (where you got your .dts from):

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-UART4-00A0.dts

with different contents:

```
/*
 * Free up the pins used by the cape from the pinmux helpers.
 */
&ocp {
P9_13_pinmux { status = "disabled"; };/* P9_13: uart4_txd */
P9_11_pinmux { status = "disabled"; };/* P9_11: uart4_rxd */
};

&am33xx_pinmux {
bb_uart4_pins: pinmux_bb_uart4_pins {
pinctrl-single,pins = <
AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_OUTPUT, 
MUX_MODE6)  /* P9_13 gpmc_wpn.uart4_txd_mux2 */
AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT, 
MUX_MODE6) /* P9_13 gpmc_wait0.uart4_rxd_mux2 */
>;
};
};

&uart4 {
/* sudo agetty 115200 ttyS4 */
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_uart4_pins>;
};
```

No idea which is right (not an ARM-guy!). The folks on port-arm@ would know.

HTH,

-RVP


Re: segfault in libterminfo with ncurses with nethack

2023-09-01 Thread RVP

On Sat, 2 Sep 2023, Brett Lymn wrote:


It could be avoided altogether if there were PRs logged against the builtin 
curses.  I do
perform sweeps of the PR database for curses related problems every now and 
then.  There was
a major update to the refresh code between 9 and 10 driven by problems raised 
by packages.



This is more a pkgsrc issue than a curses issue; and a PR was indeed filed...

-RVP


Re: segfault in libterminfo with ncurses with nethack

2023-09-01 Thread RVP

On Fri, 1 Sep 2023, Rhialto wrote:


I did an experiment with a Makefile.test which just contains

PREFER.curses=  pkgsrc
.include "../../mk/curses.buildlink3.mk"
.include "../../mk/termcap.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
[...]
Then I noticed the symlink: /usr/lib/libtermcap.so@ -> libterminfo.so
That's probably how it got linked, and not removed...



So, something like this:

PREFER.curses=  pkgsrc
.include "../../mk/curses.buildlink3.mk"
.if ! ${PREFER.curses:U} == "pkgsrc"
.include "../../mk/termcap.buildlink3.mk"
.endif
.include "../../mk/bsd.pkg.mk"

or whatever equivalent the in mk/termcap.buildlink3.mk since I see that
PDcurses also has terminfo functions built-in.

-RVP


Re: segfault in libterminfo with ncurses with nethack

2023-09-01 Thread RVP

On Fri, 1 Sep 2023, Rhialto wrote:


I guess I found a corner case in pkgsrc if you do

PREFER.curses=  pkgsrc
.include "../../mk/curses.buildlink3.mk"
.include "../../mk/termcap.buildlink3.mk"



Other people have been bitten by this ;). See PR pkg/57365 (prompted by this
thread):

https://mail-index.NetBSD.org/current-users/2023/04/16/msg043785.html

This _really_ ought to be fixed once and for all.

-RVP


Re: segfault in libterminfo with ncurses with nethack

2023-08-31 Thread RVP

On Thu, 31 Aug 2023, Rhialto wrote:


So I'm trying ncurses.

However at startup it crashes in NetBSD's libterminfo.



If you use ncurses, then you _shouldn't_ be linking in the system libterminfo
as well. Ncurses, as it's usually built, will have its own terminfo functions
built-in. (You can also pull this out as a libtinfo{,w}.*)

I think what's happening here is some functions are being pulled from the
system libterminfo and others from the ncurses impl. resulting in a
half-initialized mish-mash in ncurses's data-structures.

-RVP


Re: /dev/tty01 will not open on Beaglebone Black

2023-08-31 Thread RVP

On Wed, 30 Aug 2023, Brook Milligan wrote:


I am trying to communicate with uart4 on a Beaglebone Black, but cannot open 
/dev/tty01; open(2) just hangs.

[...]
#ls -l /dev/tty01
crw---  1 uucp  wheel  12, 1 Apr 11 12:20 /dev/tty01

However, when run by root, the following code just hangs, i.e., the open() 
never returns.

#include 
int main ()
{
  int fd;
  char const* filename = "/dev/tty01";
  fd = open(filename,O_RDWR);
}



If you open a dial-in device without O_NONBLOCK, then open() won't return until
the carrier is asserted. Does Ctrl-C (or kill -9) end the program?

-RVP


Re: How to build /usr/bin/grep?

2023-08-17 Thread RVP

On Thu, 17 Aug 2023, Christian Kujau wrote:


So, I guess my questions are:

* Why is /usr/src/usr.bin/grep/grep different from /usr/bin/grep?



/usr/src/usr.bin/grep/grep: is the FreeBSD grep (only built if MKBSDGREP=yes)
/usr/bin/grep: is actually the GNU grep (bec. MKBSDGREP=no; see mk.conf(5))


* Why is /usr/bin/grep behaving differently than /rescue/grep?



/usr/bin/grep is the GNU grep
/rescue/grep is the FreeBSD grep


* Why aren't we just using the FreeBSD grep version 2.6? :-)



Good question. Probably incompatibilities and/or bugs. Other people
have reported both. I've noticed a few myself.

-RVP


Re: Regression in 10.x installer

2023-08-15 Thread RVP

On Mon, 14 Aug 2023, salqu...@duck.com wrote:

It looks like for UEFI installation, it executes “gpt -rq header ” 
command. I did not find logs of any other command both when I selected the 
whole disk, and when I selected a particular wedge.


So, when I select the whole disk, it was:
“gpt -rq header wd0”



This looks correct.


And when I selected dk1 wedge, it was:
“gpt -rq header dk1"



This looks iffy. There's no "header" on a wedge--unless it's just trying to
get the wedge size.

I think this bug no longer exists in the sysinst where selecting preselected 
wedge fails.




Not sure. The last time I tried, you couldn't select a wedge as the installation
target. It would fail horribly.

However, there is another bug. With NetBSD 10.x installer, when 
we select the whole disk, say wd0, it removes all wedges except the EFI 
system partition from the output of “dkctl wd0 listwedges”. I see these 
errors logs scroll on the screen - removing dk2, etc.
And from that point onwards, the installer is practically unusable, because 
“dkctl wd0 listwedges” shows only EFI partition, and the installer offers 
only the system EFI partition as an option to install NetBSD.




Yes, I recall that it did just that when I installed 10.0-BETA some months
back, but nonetheless, my procedure worked fine. Maybe because I didn't exit
sysinst to create the GPT partition. I'd already created the new NetBSD
partition when I began. Try my procedure out again like that: once in sysinst
don't exit into the shell--to check on the log-data, for instance :).

Again, this bug no longer exists where we needed to manually configure these 
flags. But, there is other issue now. It either does not select any 
partition, or selects the NetBSD partition with only ‘install’ flag with 
mount-point “/". It also selects the EFI system partition as EFI. However, 
when I configure the NetBSD partition with “newfs” and “boot”, and “okay” the 
partition changes, it shows me the same install menu again asking me to 
choose the disk to install NetBSD on. Even when I accept the default 
partition setting, the behavior is the same.




I needed to fiddle with this because I already had 2 NetBSD FFS partitions
on the HDD and sysinst marked both of 'em with a mount-point of "/" and the
"I" flag was set on the 1st NetBSD FFS partition it had found.

Utility menu’s sysinst logs offers a hint though. I think it does "gpt -rq 
header dk1” when we select a preselected wedge dk1. The output of this 
command is “GPT header not found”, which makes sense because it’s a wedge and 
not a disk. So, I think the installer treats this as an error, and gives up 
trying to install NetBSD on that wedge.




Yes, this doesn't look kosher as I said above.

Do we need to create a separate EFI partition for NetBSD? Can we get away by 
using the EFI system partition? If sysinst is copying BOOTx64.EFI to the EFI 
system partition, it is correctly recognizing the partition, right?




Not needed. You can just use a different directory on the System EFI partition.
But, I like to create an EFI partition for each of the different OSes that
are on the disk.

-RVP

Re: Regression in 10.x installer

2023-08-14 Thread RVP

On Mon, 14 Aug 2023, salqu...@duck.com wrote:

Previous output was for the NetBSD 10.0 beta installer. This is for the HEAD 
installer, whose behavior is the same.




I made some notes last year which should help you install NetBSD+UEFI with
pre-existing partitions on the disk. The procedure is pretty easy:


1. Very important: In main "EFI System" partition, move the \EFI\Boot\ dir.
   out of the way.

   sysinst _will_ overwrite the BOOT*.EFI files in there.  (I've got some
   local patches which fix this, but that's on my home machine.)

2. Create partitions for NetBSD using gpt(8).

   Typically 3: a new EFI partition (any kind of FAT filesystem will do) to
   hold the NetBSD BOOT*.EFI files; a FFS partition for "/"; and finally a
   NetBSD swap partition.

In `sysinst` now:

3. First, jump into the "Utility menu" and turn-on both "Logging" and 
"Scripting".
   This creates 2 files: /tmp/sysinst.log and /tmp/sysinst.sh which you can look
   at for debugging issues.

4. In the "NetBSD-10.0_BETA Install System" main-menu, select
   a: Install NetBSD to hard disk.

5. In the "Available disks" menu, select the _ whole disk_ device: wd0, sd1,
   ld0, etc. Ie. _do not_ choose any `Preconfigured "wedges"'.

6. After choosing the disk to install onto, select:
   a: Use existing GPT partitions

7. Now you'll get a list of the existing GPT partitions on the disk.
   This list is slightly confusing the first time you do this (and sysinst
   doesn't make things easier by marking multiple FFS partitions as "/"), but
   go through it one by one and

   a) remove the "install" and "mount" flags, and
   b) set the "mount point" to "none"

   for each of the partitions which sysinst got "wrong". Then, for the NetBSD
   FFS partitions(s) you want sysinst to work on, set the "install", "newfs"
   (if you want that done) and "mount" flags to "yes" and also set the "mount
   point" ("/", "/usr", etc.)

8. Choose "Partition sizes OK" when done.

Do the rest of the install as usual. After the install is finished, move the
sysinst-written \EFI\Boot\BOOT*.EFI files from the System EFI partition to
a) the NetBSD EFI partition, or b) a different dir. on the System EFI partn.
Then tell your BIOS where the NetBSD *.EFI files are to get a boot menu.

HTH,
-RVP


Re: top(1) behavior

2023-08-13 Thread RVP

On Sat, 12 Aug 2023, Kevin Bowling wrote:


Here's a sample, this one is a bit better since the cc1plus processes
stick around for a bit longer but it still shows the WCPU% not adding
up near the global CPU stats.  I can annotate it as an image if it is
still not clear.

load averages:  6.15,  3.21,  1.67;   up 0+04:56:56
   12:37:26
142 threads: 2 runnable, 123 sleeping, 10 zombie, 7 on CPU
CPU0 states: 92.6% user,  0.0% nice,  7.4% system,  0.0% interrupt,  0.0% idle
CPU1 states: 91.6% user,  0.0% nice,  8.2% system,  0.0% interrupt,  0.2% idle
CPU2 states: 91.6% user,  0.0% nice,  8.4% system,  0.0% interrupt,  0.0% idle
CPU3 states: 89.4% user,  0.0% nice, 10.0% system,  0.0% interrupt,  0.6% idle
CPU4 states: 57.9% user,  0.0% nice, 10.2% system,  0.0% interrupt, 31.9% idle
CPU5 states: 99.8% user,  0.0% nice,  0.2% system,  0.0% interrupt,  0.0% idle
CPU6 states: 96.2% user,  0.0% nice,  3.4% system,  0.0% interrupt,  0.4% idle
CPU7 states: 97.0% user,  0.0% nice,  3.0% system,  0.0% interrupt,  0.0% idle
Memory: 7213M Act, 5392K Inact, 110M Wired, 105M Exec, 5933M File, 7165M Free
Swap: 16G Total, 16G Free / Pools: 1017M Used

PID   LID USERNAME PRI STATE   TIME   WCPUCPU NAME  COMMAND
1598  1598 kev00925 CPU/5   0:26 98.03% 72.66% - cc1plus
6906  6906 kev00925 CPU/7   0:26 96.51% 71.53% - cc1plus
29633 29633 kev00925 CPU/2   0:01 64.58%  6.15% - cc1plus
6016  6016 kev00925 CPU/6   0:01 75.00%  3.66% - cc1plus
5636  5636 kev00925 CPU/1   0:01 50.00%  2.44% - cc1plus



You'll see the same behaviour even on FreeBSD if the CPU-intensive commands
finish quickly. The CPU-states display is a like a running-average, the
process-display is more like a snapshot. Try reducing the sleep time to, say,
.1s or run a few `openssl speed' tests to see this.

-RVP


Re: cannot disable output processing in pseudo-terminal (between openpty(3) parent and child)

2023-07-30 Thread RVP

On Sun, 30 Jul 2023, pouya+lists.net...@nohup.io wrote:


One of my use cases requires the child process to emit a binary
stream to be read by the parent.  The parent is notified first via
a specific escape sequence.  This almost works, except I can't
figure out how to disable output processing on this stream, and in
particular the parent receives extra CR characters for every LF
(NL) the child sends.



You'll have to turn off the NL -> CRNL output processing the kernel
does on your behalf (after all, this is still a "terminal" we're
talking about and not a simple pipe). Don't set the ONLCR bit in
the output-modes of the child pty.

Note that the shell you're running on the child-side also matters.
If that does any fancy line-editing using libedit or readline, say,
then that could change the ONLCR bit every time the shell has to
read input.


P.S. This other one's not as important but I'm also confused by
why disabling ECHO on the parent stdin also disables it for the
pseudo-terminal.



It shouldn't--unless you've unset that bit on the master then copied
those settings over onto the child pty FD.

-RVP


Re: Cannot Install From NetBSD-9.3-amd64-install.img -- Friday Afternoon Followup

2023-07-15 Thread RVP

On Fri, 14 Jul 2023, Jay F. Shachter wrote:


Now the installation procedure is dying with the message

Status: openpty() failed
   Command: disklabel -w -r -f /tmp/disklabel.13 wd0 'wd0' 'fictitious'



Hmm. I can tell you _why_ you would get that error message, but, I just
can't see _how_ you could get into a situation which would occasion this
error.

Can you:

a) the exact URL of the install image you wrote to the USB disk?
b) show the output of these commands (after exiting the installer):

mount
ls -l /dev/pt*

After that, running this should let you proceed with the installation:

mount -t ptyfs ptyfs /dev/pts

-RVP



Re: Found /bought new mouse

2023-07-15 Thread RVP

On Fri, 14 Jul 2023, Todd Gruhn wrote:


Does not have BlueTooth. Do I need this? OR use the BlueTooth already in
computer??? (Another mouse)



Connect that Bluetooth-to-USB dongle to your computer and your mouse
should appear as a USB mouse.

-RVP


Re: Cannot Install From NetBSD-9.3-amd64-install.img

2023-07-14 Thread RVP

On Thu, 13 Jul 2023, Jay F. Shachter wrote:


The computer immediately says "Invalid partition table!"



This is very likely a message from the BIOS telling you that there's something
wrong with the partition table. Just zero it out:

Exit the installer (sysinst) in the main menu, then run:

dd if=/dev/zero of=/dev/rwd0 bs=1m count=10

That will zero-out 10 MB of your first (S)ATA disk. Make sure you
have the correct disk here! You can get back to installer by typing
`exit' or Ctrl-D.


And then, a few seconds later, it crashes.
 [   6.5091723] nouveau0: error: unknown chipset ()



This looks like flaky hardware. Disabling the nouveau DRMKMS driver like the
previous user suggested should work here. At the bootloader prompt, you can
also do:

userconf disable nouveau*
boot


-RVP


Re: Fun with sound; and computers

2023-06-26 Thread RVP

On Mon, 26 Jun 2023, Todd Gruhn wrote:


Is there a way connect sound and F-key?

Each time I press on F-key , computer makes a sound.



In X, xbindkeys: https://pkgsrc.se/x11/xbindkeys

-RVP


Re: ctwm focus on new window?

2023-06-05 Thread RVP

On Sun, 4 Jun 2023, adr wrote:


has someone hacked ctwm to give focus to newly created windows,
like AutoFocusToTransients but for all windows?



I've some other patches for ctwm. Does "ClickToFocus" or "SloppyFocus"
work for you?

-RVP



Re: touch screen support

2023-05-29 Thread RVP

On Sun, 28 May 2023, Dave Tyson wrote:


I have a couple of devices which report a touch screen present, but
don't attach it correctly, failing with "touchscreen has no range
report"



Yeah, my laptop had the same issue and I worked around it by using
this gross hack (for 9.x, but, should apply to 10.x):

```
--- uts.c.orig  2019-05-05 03:17:54.0 +
+++ uts.c   2022-03-31 22:13:33.0 +
@@ -213,6 +213,10 @@
 */
aprint_debug_dev(sc->sc_hdev.sc_dev,
"ELAN touchscreen found, working around bug.\n");
+   } else if (uha->uiaa->uiaa_vendor == USB_VENDOR_ATMEL &&
+  uha->uiaa->uiaa_product == 0x8417) {
+   aprint_debug_dev(sc->sc_hdev.sc_dev,
+   "Atmel maXTouch Digitizer found, working around 
bug.\n");
} else {
aprint_error_dev(sc->sc_hdev.sc_dev,
"touchscreen has no range report\n");
```

That got my touchscreen working with the `ws' Xorg driver. Pretty sure
this isn't the *right* way to do it, but, I didn't have the time to
wade through the USB specs. & NetBSD kernel docs. for the correct
solution. :)

HTH,

-RVP

PS. Happy to run commands/test patches/etc. if someone more
knowledgeable is willing to do a proper job of this.


Re: How to use the 'ls' -M flag?

2023-05-26 Thread RVP

On Fri, 26 May 2023, Michael Cheponis wrote:


I'm having no success trying to get ls to print file sizes, using the -M
flag.



The `thousands separator' char. is locale-specific. In the default C/POSIX
locale, it is "":

$ locale -c thousands_sep
LC_NUMERIC
$ LC_NUMERIC=C locale -c thousands_sep
thousands_sep=""
$ LC_NUMERIC=en_US.UTF-8 locale -k thousands_sep
thousands_sep=","
$ LC_NUMERIC=en_US.UTF-8 ls -lM /netbsd.GENERIC
-rwxr-xr-x  1 root  wheel  29,529,152 May 24 13:09 /netbsd.GENERIC
$

Set some locale in ~/.profile (or ~/.xinitrc, ~/.xsession, ...). Eg.:

export LANG=en_GB.UTF-8
export LC_CTYPE=$LANG
export LC_ALL=""

-RVP


Re: Firefox (pkgsrc binary): no sound

2023-04-16 Thread RVP

On Sat, 15 Apr 2023, tlaro...@polynum.com wrote:


Having updated Firefox to 107.0.1, and being on NetBSD 9.3/amd64, there
is now no sound when trying to watch/listen a video.



Works for me: recent 9.3_STABLE + newly installed firefox-107.0.1.


Has anyone a clue about how to find what Firefox is using or trying to use?



One method is to use fstat(1) when the video is being played (or even when
paused). One of the firefox processes should have /dev/audio opened:

```
$ for pid in $(pgrep -x /usr/pkg/lib/firefox/firefox) ;
  do fstat -p $pid; done | fgrep audio
rvp  firefox 6654   40* audio 0xe710678a5cb0
$
```

Check the `about:support' page too. Mine shows:

```
Media

Audio Backend   sun
Max Channels12
Preferred Sample Rate   48000
Roundtrip latency (standard deviation)  NaNms (NaN)
Output Devices
NameGroup   Vendor  State   Preferred Format
  Channels  Rate   
Latency
VIA product 8446 01h (default)  /dev/audio  VIA Enabled All   default: 
S16LE, support: S16LE  2 default: 48000, support: 1000 - 192000 40 
- 7680
VIA product 8446 01h (0)/dev/audio0 VIA Enabled None  default: 
S16LE, support: S16LE  2 default: 48000, support: 1000 - 192000 40 
- 7680
Intel product 2806 01h (1)  /dev/audio1 Intel   Enabled None  default: 
S16LE, support: S16LE  2 default: 48000, support: 1000 - 192000 40 
- 7680
```


The only thing that seems relevant, when capturing error messages, is
this:

OpenCubeb() failed to init cubeb: file
/work/www/firefox/work/firefox-107.0.1/dom/media/AudioStream.cpp:281

What is "cubeb"?



https://github.com/mozilla/cubeb
https://github.com/mozilla/cubeb/wiki/Backend-Support
https://blog.mozilla.org/webrtc/firefoxs-audio-backend/

-RVP


Re: Assembly example (nasm) for amd64 in NetBSD

2023-04-14 Thread RVP

On Fri, 14 Apr 2023, Rocky Hotas wrote:


Even if this is intended to be amd64 code, built as `nasm -f elf64'?



Yes. `.note.netbsd.ident' is 24 bytes (4 + 4 + 4 + 8 + 4) on both 32- and
64-bit platforms. See:

/usr/include/elf.h (line 916-...)

and the check for this ELF tag in:

/usr/src/sys/kern/exec_elf.c:netbsd_elf_note()


IIUC, you replaced `db' (``define byte'') and `dq' (``define quadword'',
that should be 8 bytes) with `dd' (``define double word'', that is 4
bytes, 32 bit). So the section only contains now `dd's.



Yes, I thought it would be simpler to grok the section size if I used
the same type throughout.


I can't understand the ``NetBSD string'', which is the concatenation of
the 6 characters `NetBSD', the NULL character, and `$'. Is this a
conventional string? Where can I find it?



That last '$' is me misremembering MASM syntax :) Fortunately, it still
amounted to 8 bytes in the end.



Also, in the code comments, it is stated to be ``8 bytes'' and it is in
the first version of your code, but now it is only 6 bytes, `NetBSD'. Is
it the same?



It's still the same size: 8 bytes. According to the nasm docs, both

db "NetBSD",0,0

and

dd "NetBSD"

are equivalent. For `dd', the extra 2 bytes are filled with '\0'.


+section .note.netbsd.ident note alloc noexec nowrite align=4


You added `note alloc noexec nowrite align=4'. I didn't know much about
the toolchain, so I'm not able to understand well these new strings.



`readelf -Wa foo' is what I used when comparing your executable with the
regular ones. The same command will also show you the section sizes.



By `nasm docs' you refer to the manpage nasm(1)?



No, the stuff in /usr/pkg/share/doc/nasm.

HTH,

-RVP


Re: Assembly example (nasm) for amd64 in NetBSD

2023-04-14 Thread RVP

On Fri, 14 Apr 2023, Rocky Hotas wrote:


On apr 14  1:46, RVP wrote:


+section .note.netbsd.ident
+
+   dd 7; ELF_NOTE_NETBSD_NAMESZ
+   dd 4; ELF_NOTE_NETBSD_DESCSZ
+   dd 1; ELF_NOTE_TYPE_NETBSD_TAG
+   db 'NetBSD',0,'$'   ; NetBSD string
+   dq 90300; NetBSD version 9.3.0


It works, thank you!



Ah, the `version' should be int32 not int64. And, looking at the
nasm docs. suggests that sections can be annotated to match what
the toolchain adds, This is better:

```
--- testcpu.s.orig  2023-04-14 08:28:30.834209346 +
+++ testcpu.s   2023-04-14 08:33:27.461564949 +
@@ -23,3 +23,11 @@
 mov rax, 1
 mov rbx, 0
 syscall
+
+section .note.netbsd.ident note alloc noexec nowrite align=4
+
+   dd 7; ELF_NOTE_NETBSD_NAMESZ
+   dd 4; ELF_NOTE_NETBSD_DESCSZ
+   dd 1; ELF_NOTE_TYPE_NETBSD_TAG
+   dd 'NetBSD' ; NetBSD string (8 bytes)
+   dd 90300        ; NetBSD version 9.3.0
```

-RVP


Re: Assembly example (nasm) for amd64 in NetBSD

2023-04-13 Thread RVP

On Thu, 13 Apr 2023, Rocky Hotas wrote:


On NetBSD 9.0 I built it with

nasm -f elf64 -o testcpu.o testcpu.s
ld -s -o testcpu testcpu.o

This gives no error, however the file can not execute. If I try to run
the file, I obtain:

/bin/sh: Cannot execute ELF binary ./testcpu



Try adding a ".note.netbsd.ident" section:

```
$ diff -u testcpu.s.orig testcpu.s
--- testcpu.s.orig  2023-04-14 01:42:08.984238899 +
+++ testcpu.s   2023-04-14 01:41:06.204866303 +
@@ -23,3 +23,11 @@
 mov rax, 1
 mov rbx, 0
 syscall
+
+section .note.netbsd.ident
+
+   dd 7; ELF_NOTE_NETBSD_NAMESZ
+   dd 4; ELF_NOTE_NETBSD_DESCSZ
+   dd 1; ELF_NOTE_TYPE_NETBSD_TAG
+   db 'NetBSD',0,'$'   ; NetBSD string
+   dq 90300; NetBSD version 9.3.0
$
```

-RVP


Re: "Could not load a transcoding service" error

2023-04-04 Thread RVP

On Tue, 4 Apr 2023, Mayuresh wrote:


I have added wip/suse15_glibc-locale-base

However, would it be more appropriate to add it to any of the existing
packages such as suse15_locale? As one would naturally look up there in
case of locale related issues.



My preference is to keep it as it is in the SuSE Linux distribution, but,
combining `suse15_base' and `suse15_glibc-locale-base' also makes sense
as they're both base glibc packages. The folks on tech-pkg@ would know
better :)

-RVP


Re: "Could not load a transcoding service" error

2023-04-04 Thread RVP

On Tue, 4 Apr 2023, Mayuresh wrote:


I notice here[1] that SuSE 15 SP2 is a `supported platform'

pkgsrc has 15.5. May be I'll try changing that to 15.2

(Just hope that .2 and SP2 are the same thing!)



Just untar the `glibc-locale-base-2.31-150300.41.1.x86_64.rpm' from the
link on this page: https://pkgsrc.se/emulators/suse15_locale

That should be enough to fix your issue pronto. Create a new package
for it if it works. The same for: libncurses6-6.1-15.5.12.1.x86_64.rpm
and terminfo-base-6.1-15.5.12.1.x86_64.rpm.

-RVP


Re: "Could not load a transcoding service" error

2023-04-03 Thread RVP

# This is the error in question. The vivado shell exits on this

Could not load a transcoding service


From web searches, the error appears related to locales. suse15_locales is
installed, though I do not know if that gets used.



That package looks incomplete. Can you copy the

/emul/linux/usr/lib64
/emul/linux/usr/share

directories from the `suse_locale-13.1nb4.tgz' package?

Or, if that doesn't work (glibc is version 2.18 in the suse_base-13
package, and 2.31 in the suse_base-15 one), try copying those
dirs. from a system running glibc-2.31.

-RVP

PS. You could also see if your package works with the older glibc-2.18
in SuSE 13.


Re: Invisible mouse pointer

2023-03-27 Thread RVP

On Mon, 27 Mar 2023, Mayuresh wrote:


It's vmware, I suppose:



Man-pages sometimes don't reflect what drivers actually do. Can
you check if the vmware driver is doing HW or SW cursor (you
will want a SW cursor):

$ fgrep -i cursor /var/log/Xorg.0.log

-RVP



Re: Invisible mouse pointer

2023-03-26 Thread RVP

On Sun, 26 Mar 2023, Mayuresh wrote:


On Fri, Mar 24, 2023 at 09:33:22PM +, RVP wrote:

Try toggling the "HWCursor" option. See:


No luck with that!



Not all X display drivers will have that option. The `vmware' driver does,
where it defaults to `off'. Which driver is Xorg using on NetBSD? Check
/var/log/Xorg.0.log.

-RVP


Re: Invisible mouse pointer

2023-03-24 Thread RVP

On Fri, 24 Mar 2023, Mayuresh wrote:


I am running the following NetBSD version

   NetBSD asus2n 10.99.2 NetBSD 10.99.2 (GENERIC) #0: Wed Mar 22 03:17:18 UTC 
2023  mkre...@mkrepro.netbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64

on qemu 7.1.0 on void Linux, with "-vga vmware" option.

Using native xorg.
[...]
However with "-vga vmware", the mouse pointer is not visible (although it
is visible if I use "-vga std").
[...]
Is there any way to diagnose / fix this?



Try toggling the "HWCursor" option. See:

https://man.netbsd.org/amd64/vmware.4

-RVP



Re: NetBSD 9.3 amd64 won't turn off display backlight

2023-01-23 Thread RVP

On Mon, 23 Jan 2023, Valery Ushakov wrote:


Does screenblank(8) work?  You can force the screen off imeediately
with

 screenblank -b

and unblank with

 screenblank -u



If you have DRMKMS enabled, then this actually works! The program is
completely new to me, so thanks Uwe!

-RVP


Re: NetBSD 9.3 amd64 won't turn off display backlight

2023-01-23 Thread RVP

On Mon, 23 Jan 2023, Damien Boureille wrote:


Thanks. I tried that, however this has dependencies on X, and even then, it 
wouldn't work.



If you mean the dependency on libdrm, then that can be eliminated.
The code just needs libpciaccess.


I also tried blacklisting i915drmdkms, booting from both BIOS and UEFI, and 
using genfb instead of acpivga.



genfb won't work here. It's the DRMKMS driver (for intel) that does
brightness control. Since that isn't working (yet), we use
`intel_backlight' which fiddles with the PCI registers in the same
way (but directly).

I could understand the newer intel cards not working because they
have newer PCHs (Platform Controller Hubs), but, your card is old
enough that it should've worked.

- What error (if any) did intel_backlight produce?

- Can you post a complete dmesg output?

- And a full `pcictl pci0 list'

so that we can see what PCH you have?

-RVP



Re: sending/receiving UTF-8 characters from terminal to program

2023-01-21 Thread RVP

On Fri, 20 Jan 2023, Thomas Dickey wrote:


May be you need to specify -u8 option or utf8 resource?



That would work. So would running uxterm instead of xterm, but, all of
these mess-up command-line editing: Alt+key is converted into a char.
code instead of an ESC+key sequence.


perhaps you're referring to eightBitInput (see manpage)



That seems to get set when running as uxterm/UTF-8 locale. However, 
`XTerm*metaSendsEscape: true' (which I have set for XTerm, but, not for

UXTerm) fixes things right back, so it's all OK :)


XTerm*locale: true


that's redundant, since the default "medium" will give the same effect :-)



Great! That's something I didn't know. Thanks, Tom.

Cheers,
-RVP


Re: sending/receiving UTF-8 characters from terminal to program

2023-01-20 Thread RVP

On Fri, 20 Jan 2023, Valery Ushakov wrote:


On Fri, Jan 20, 2023 at 15:09:44 +0100, r0ller wrote:


Well, checking what printf results in, I get:

$printf 'n?z'|hexdump -C
  6e e9 7a  |n.z|
0003
$printf $'n\uE9z'|hexdump -C
  6e c3 a9 7a   |n..z|
0004

It's definitely different from what you got for 'n?z'. What does
that mean?


In the second example you specify \uE9 which is the unicode code point
for e with acute.  It is then uncondionally converted by printf to
UTF-8 (which is two bytes: 0xc3 0xa9) on output.

Your terminal input is in 8859-1 it seems.



That's it. The terminal emulator is not generating UTF-8 from the keyboard
input.


May be you need to specify -u8 option or utf8 resource?



That would work. So would running uxterm instead of xterm, but, all of
these mess-up command-line editing: Alt+key is converted into a char.
code instead of an ESC+key sequence.

R0ller, do this:

1. Add your locale settings in ~/.xinitrc (or ~/.xsession if using xdm):

export LANG=hu_HU.UTF-8
export LC_CTYPE=hu_HU.UTF-8
export LC_MESSAGES=hu_HU.UTF-8


2. In ~/.Xresources, tell xterm to use the current locale when generating
   chars.:

XTerm*locale: true

   The `-lc' option does the same thing. If using uxterm, the class-name
   becomes `UXTerm'.




On Fri, 20 Jan 2023, Robert Elz wrote:


I believe bash will take your current locale into account
when doing that [...]



That's correct. But as r0ller had a UTF-8 locale set, I didn't mention that.
However, it is better to be precise, so thank you!

-RVP


Re: sending/receiving UTF-8 characters from terminal to program

2023-01-20 Thread RVP

On Fri, 20 Jan 2023, r0ller wrote:


Thanks for your efforts to reproduce it :) I just don't get why it works for 
you with the same locales and why it doesn't for me.
Are there any other settings that affect encoding besides LC variables and LANG?



Since we seem to have the same flookup binary, check against the
magyar.fst I used:

https://github.com/r0ller/alice/tree/master/hi_android/foma

Next check that the input you're feeding to flookup actually _is_
UTF-8. Both /bin/sh and bash output UTF-8 if given Unicode code-
points in the form `\u'. So,

$ printf 'néz' | hexdump -C
  6e c3 a9 7a   |n..z|
0004
$ printf $'n\uE9z' | hexdump -C
  6e c3 a9 7a   |n..z|
0004
$

If that works, then check those UTF-8 bytes against whatever the
terminal emulator generated from your keystrokes for the `é'
in `néz'.

-RVP


Re: sending/receiving UTF-8 characters from terminal to program

2023-01-19 Thread RVP

On Wed, 18 Jan 2023, r0ller wrote:


Actually, it's just inconvenient to always type the strings what
I want to analyse in a program, compile and execute it instead of
giving it a go from the shell.



In a pinch, you can always use iconv(1) to do your conversions:

```
$ printf néz | hexdump -# locale is en_GB.UTF-8 ie. UTF-8
  6e c3 a9 7a   |n..z|
0004
$ printf néz | iconv -f UTF-8 -t ISO-8859-1 | hexdump -C
  6e e9 7a  |n.z|
0003
$
```

-RVP

Re: sending/receiving UTF-8 characters from terminal to program

2023-01-19 Thread RVP

On Thu, 19 Jan 2023, Rhialto wrote:


I think there is some encoding confusion going on here. I still use
boring old Latin-1 (iso 8859-1), and I saw the two occurrences of the
word nz differently.


echo néz|flookup magyar.fst
echo néz|flookup magyar.fst


The first case with 1 letter in the middle looking like an e + aigu,
the second time as 2 characters, probably an utf-8 encoding.



Yeah, some kind of encoding mismatch is responsible. Everything worked
for me because

a) all the text I copy-pasted were UTF8 (even the 2nd one, which,
   unsurprisingly, didn't work.)

b) flookup was OK with UTF-8 input (or my converted UTF-8 input to match
   the text encoding in magyar.fst)

c) text in magyar.fst was in UTF-8/Unicode (or, if another encoding, then
   flookup did the conversion before doing the text lookup.)

b) and c) are educated guesses.

-RVP

Re: sending/receiving UTF-8 characters from terminal to program

2023-01-19 Thread RVP

On Wed, 18 Jan 2023, r0ller wrote:


echo néz|flookup magyar.fst

it results in:

néz +?

However, when passing the string as:

echo néz|flookup magyar.fst

I get a successful analysis:

néz    +swConsonant+néz[stem]+CON
néz    +swConsonant+néz[stem]+CON+Nom
néz    néz[stem]+Verb+IndefSg3



That should work--and it does. With a just compiled flookup (from
foma-0.9.18.tar.gz in the link you provided, and the .fst file got
by googling):

```
$ uname -a
NetBSD x202e.localdomain 9.3_STABLE NetBSD 9.3_STABLE (GENERIC) #0: Sat Jan  7 
15:04:01 UTC 2023  
mkre...@mkrepro.netbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
$ export LANG=hu_HU.UTF-8
$ export LC_CTYPE=hu_HU.UTF-8
$ export LC_MESSAGES=hu_HU.UTF-8
$ /tmp/F/bin/flookup -v
flookup 1.03 (foma library version 0.9.18alpha)
$ echo néz | /tmp/F/bin/flookup alice-master/hi_android/foma/magyar.fst
néz +swConsonant+néz[stem]+CON
néz +swConsonant+néz[stem]+CON+Nom
néz néz[stem]+Verb+IndefSg3

$ echo néz | /tmp/F/bin/flookup alice-master/hi_android/foma/magyar.fst
néz+?

$
```

-RVP


Re: NetBSD 9.3 amd64 won't turn off display backlight

2023-01-17 Thread RVP

On Thu, 29 Dec 2022, Damien Boureille wrote:


I'm running NetBSD 9.3-amd64 GENERIC on a Dell Precision M4600 (Sandy Bridge) 
mobile workstation, used as a server.

Closing the lid will not turn off the backlight, which conducts and builds up 
heat inside the case.
[...]
I'm using an i915 chipset:

# pcictl pci0 list
000:00:0: Intel Sandy Bridge (mobile) Host Bridge (host bridge, revision 0x09)
000:02:0: Intel Sandy Bridge (mobile) GT2+ Integrated Graphics Device (VGA 
display, revision 0x09)
(...)



Since you have an Intel card, you can install the `intel_backlight'
package, and call it in the `/etc/powerd/scripts/lid_switch' script.

-RVP



Re: -current i915drmkms status [Was: NetBSD 9.99.108 unable to start modular X]

2022-12-12 Thread RVP

On Mon, 12 Dec 2022, Mayuresh wrote:


/libdata/firmware/i915drmkms/i915/something.bin


Placed the entire i915 folder at above path.

Tried modesetting, intel, wsfb : none work.



Welcome to the club... You'll find the rest of the gang here already:

https://mail-index.netbsd.org/current-users/2022/07/21/msg042710.html

Please post to that thread:

a) full dmesg output after you boot with `boot -vx' at the bootloader
   prompt, and
b) the /var/log/Xorg.0.log file with the modesetting Xorg driver.


With wsfb there is a very thin white line at the top of the screen and if
I do Ctrl-d in that X exits, so looks like a terminal is coming up in that
thin line.



Yes. I get that same 1-pixel framebuffer with the wsfb(4) Xorg
display-driver running on top of the DRMKMS module's `intelfb'
framebuffer. wsfb(4) on top of the generic genfb(4) is OK as you saw.

Uncomment the `Option "AccelMethod" "none"' in the config. fragment I
sent you. Then see if modesetting(4) comes up. For the intel(4) driver,
try `Option "AccelMethod" "UXA"', or even `"none"' as a last resort. The
intelfb(4) manpage lists other options which you can turn off or disable
with the SNA or UXA accel-methods.

-RVP


Re: -current i915drmkms status [Was: NetBSD 9.99.108 unable to start modular X]

2022-12-12 Thread RVP

On Mon, 12 Dec 2022, Mayuresh wrote:


On NetBSD 9.99.108 amd64 on a laptop, if I disable i915drmkms module I am
able to do startx. However then I do not get HDMI output.



With the DRMKMS driver disabled, you'll get `genfb' which is just a dumb
framebuffer driver. There's no HDMI with this. Only the primary display
will work with the genfb/wsfb (the Xorg driver which you'll very likely
be getting) combo.


With i915drmkms enabled I can get HDMI output but then I don't get X11 and
dmesg shows

   Asynchronous wait on fence i915drmkms0:X[17637]:2 timed out 
(hint:0x8075ce30)



Try the `modesetting' Xorg driver instead of `intel' and make sure the GPU
firmware blobs are present in /libdata/firmware/i915drmkms. Get these from
here:

https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915

The blobs should finally have a path like:

/libdata/firmware/i915drmkms/i915/something.bin

$ cat /etc/X11/xorg.conf.d/modesetting.conf
# Depends on kernel DRM
#
Section "Device"
Identifier  "Card0"
Driver  "modesetting"
# Option  "SWcursor" "on"
# Option  "ShadowFB" "off"
# Option  "AccelMethod" "none"
EndSection
$

-RVP



Re: NetBSD 9.3 UEFI installation help

2022-12-01 Thread RVP

On Thu, 1 Dec 2022, Mayuresh wrote:


Something like this boots:
set root=(hd0,gpt1)
knetbsd /netbsd --root=dk5
boot

But it says

error: no suitable video mode found
Booting in blind mode



I don't usually boot NetBSD via grub, but, this worked:

---
$ cat /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry 'NetBSD-HEAD' --class netbsd --class bsd --class os --id 'netbsd' {
gfxmode 1366x768
insmod part_gpt
insmod efi_gop
insmod gfxterm
set gfxpayload=keep
insmod ufs2
set root=(hd0,gpt10)
knetbsd /netbsd
boot
}
$ sudo update-grub
---

You may have load a different module for VESA, and change the resolution.

-RVP


Re: help with cron/rsync error message

2022-11-20 Thread RVP

On Fri, 18 Nov 2022, Steve Blinkhorn wrote:


Anything to do with system configuration or services - mostly
concentrated in /etc but also including, for instance, /var/cron/tabs -
needs protection in the upgrade process.  What would be ideal would be
a process that never overwrites a customised configuration file with a
fresh new default.



sysinst takes care of that. the etc and xetc sets are unpacked into a
/.sysinst directory and the postinstall(8) script is then run on that.
You then just need to run etcupdate(8) to merge any differences. And
since root's crontab is part of the etc set, it too will not be
overwritten.

I did an update just now from 9.3_STABLE to -HEAD using a new USB install
image, and the process went smoothly except for 2 minor issues:

1. -HEAD has a new user `_dhcpcd' to run the dhcpcd client. This is not
   present in 9.3. After a careful merge of /etc/passwd and /etc/group
   using etcupdate, I rebooted the system into 9.99.106. dhcpcd(8) ran
   _before_ the /etc/rc.d/sysdb script was executed to update master.passwd,
   so dhcpcd complained that it couldn't find its user, but, continued
   working nonetheless. One more reboot made things alright.

2. The postinstall script run by sysinst as the final step in the upgrade
   process, removed some obsolete files, but, not all of them. I now have
   many "compat" files lying around in /lib and /usr/lib :). Presumably,
   these won't hurt the system.

Short version: Do an upgrade on a separate machine first to get the feel of
it, and then the process won't feel as scary.

-RVP


Re: help with cron/rsync error message

2022-11-16 Thread RVP

On Wed, 16 Nov 2022, Steve Blinkhorn wrote:


Results are:
1.  cron: in pam_vprompt(): no conversation function



I think when you upgraded your machines, you may have extracted all the sets
except {,x}etc (and, not used sysinst to do the update?).

In 8.x, cron doesn't use PAM, so no /etc/pam.d/cron is present. The cron in
9.x is built with PAM support and therefore comes with a PAM config. file.
When this new cron runs but doesn't find a /etc/pam.d/cron, it spits out
these errors:

```
cron[3913]: (CRON) pam_authenticate failed (System error)
cron: in pam_vprompt(): no conversation function
```

Install the cron PAM file from the 9.2 etc set; and, to forestall any more
issues of this sort, get etc.tar.xz (and xetc.tar.xz if you've installed X)
and merge it using etcupdate:

```
# etcupdate -s /tmp/etc.tar.xz -s /tmp/xetc.tar.xz
```


File: /usr/lib/libpam.so.4.0

String dump of section '.comment':
 [ 0]  GCC: (NetBSD nb2 20150115) 4.8.4



sysinst should've removed all these older versions when it upgraded the
system, but as none of the symlinks point to it, having it around it shouldn't
cause any problems.

-RVP


Re: can not download IMAP messages with isync/mbsync

2022-11-15 Thread RVP

On Mon, 14 Nov 2022, RVP wrote:


On Mon, 14 Nov 2022, Mouse wrote:


My guess is that the buffer you're testing with is near the top of the
address space, within ~1GB of address 0x, and what you're
seeing is due to wraparound.



Thanks for that analysis--address-wrapping was my first guess too, but,
I didn't have the time to confirm it: the 1GB was with a standalone
program; in mbsync itself, the range was much smaller--less than 1MB even.



Well, that 1GB vs 1MB difference is easily explained. In my test code,
below, I originally had `const char* const s = "hello"'. So, `s' pointed
to a data segment address instead of the stack.

And, the wraparound seems to happen at 0x7fff instead of 0x.
Don't know ARM well enough to explain why.

---START---
#include 
#include 
#include 
#include 

static void
f2(const char* fmt, va_list ap)
{
size_t max, l = 0, n;
const char* s;

if (*fmt != 's')
return;
s = va_arg(ap, const char *);
n = strlen(s);
for (max = ULONG_MAX; max != 0; max /= 2)
if ((l = strnlen(s, max)) == n)
break;
printf("s @ %p, got len=%zu when max=%zu\n", s, l, max);
}

static void
f1(const char* fmt, ...)
{
va_list ap;

va_start(ap, fmt);
f2(fmt, ap);
va_end(ap);
}

int
main(void)
{
const char s[] = "hello";

f1("s", s);
return 0;
}
---END---

-RVP


Re: help with cron/rsync error message

2022-11-15 Thread RVP

On Tue, 15 Nov 2022, Steve Blinkhorn wrote:


the cron/rsyncd.conf etc. config in place.  I checked that everything
ran normally back in July, but now I find /var/log/cron is full of
lines like this:

Nov 14 22:02:00 trafalgar cron[3913]: (CRON) pam_authenticate failed
(System error)



PAM System errors should've been logged. What's the output of these:

```
$ fgrep cron /var/log/messages
$ readelf -p .comment /usr/sbin/cron /usr/lib/libpam.so*
$ readelf -p .comment /usr/lib/security/pam_rootok.so.4
$ file /usr/lib/security/pam_rootok.so.4
$ ls -l /usr/lib/security/pam_rootok.so.4
```

-RVP



Re: can not download IMAP messages with isync/mbsync

2022-11-14 Thread RVP

On Mon, 14 Nov 2022, Mouse wrote:


My guess is that the buffer you're testing with is near the top of the
address space, within ~1GB of address 0x, and what you're
seeing is due to wraparound.



Thanks for that analysis--address-wrapping was my first guess too, but,
I didn't have the time to confirm it: the 1GB was with a standalone
program; in mbsync itself, the range was much smaller--less than 1MB even.


Also,

-   uint maxlen = UINT_MAX;
+   uint maxlen = sizeof(buf);

if maxlen is passed unchanged to strnlen, I can't see how the original
code isn't a bug; there's no point in using strnlen if you're pass a
maxlen greater than the space remaining in the buffer your pointer
points into.



It _is_ passed as-is to strnlen(). I chose sizeof(buf) instead of UINT_MAX
because `buf' seemed sized for the RFC-5322 recommended line-length limit
of 998 octets.


The 9.1 manpage for strnlen says

The strnlen() function returns either the same result as strlen() or
maxlen, whichever is smaller.

which makes this a violation of its spec.



Right, then Marko can file a PR so that this can be fixed a) either in the
ARM assembly, or b) by NetBSD-ARM just using the C version like the other
ports.

Thx,
-RVP


Re: can not download IMAP messages with isync/mbsync

2022-11-13 Thread RVP

On Mon, 7 Nov 2022, RVP wrote:


I've not been able to reproduce this at all even with 3 servers (2
providers and 1 local [dovecot +COMPRESS]) on 9.3_STABLE/amd64.



OK. Once I had QEMU + NetBSD-ARMv7 running, it turned out to be an easy
issue to diagnose. Turn out, on ARM, strnlen(3) is written in assembly
and this always returns `maxlen' for any value of `maxlen' > ~1GB. I
don't know any ARM assembly, so I haven't chased this any further.

The fix is either:

a) Configure isync-1.4.4 to _not_ use the system strnlen(). It will
   then use its own implementation which seems to work fine.

```
$ env ac_cv_func_strnlen=no ./configure ...
$ make
$ make install
```

OR

b) Apply this patch:

```
diff -urN isync-1.4.4.orig/src/drv_imap.c isync-1.4.4/src/drv_imap.c
--- isync-1.4.4.orig/src/drv_imap.c 2021-12-03 10:56:16.0 +
+++ isync-1.4.4/src/drv_imap.c  2022-11-14 06:58:25.037251216 +
@@ -541,7 +541,7 @@
add_seg( s, l );
if (!c)
break;
-   uint maxlen = UINT_MAX;
+   uint maxlen = sizeof(buf);
c = *++fmt;
if (c == '\\') {
c = *++fmt;
```

This restricts `maxlen' to the size of the buffer we're using. (The amt.
actually written will of course be smaller--the code takes care of that.)

-RVP



Re: apache parked processes using CPU

2022-11-13 Thread RVP

On Sun, 13 Nov 2022, Jan Schaumann wrote:


About two days ago, my apache-2.4.54 running on my
NetBSD-9.3 amd64 VPS started leaving multiple
processes in 'parked' state, utilizing a lot of CPU:

 PID USERNAME PRI NICE   SIZE   RES STATE  TIME WCPUCPU COMMAND
21048 nobody420   316M   14M parked 5:28 7.32%  7.32% httpd
17677 nobody420   318M   14M parked 5:25 6.69%  6.69% httpd
16398 nobody410   319M   17M parked18:53 5.03%  5.03% httpd
 829 nobody410   320M   18M parked18:59 4.83%  4.83% httpd
21512 nobody420   322M   19M parked18:49 4.74%  4.74% httpd
23308 nobody420   322M   19M parked18:51 1.61%  1.61% httpd
   0 root 1250 0K   20M vdrain11:44 0.00%  0.00% [system]
[...]
Anybody have any ideas how to pinpoint what caused
this?



If the timeout given to _lwp_park() (or whatever that calls it here) is
too short, then the threads will just repeatedly re-enter the kernel with
another syscall.

Attach GDB to one of the httpd processes and check what the
timespec/timeval values are.

-RVP


Re: can not download IMAP messages with isync/mbsync

2022-11-07 Thread RVP

On Sun, 6 Nov 2022, Marko Bauhardt wrote:


This give me the following error while `configure`

```
configure: error: compiler does not support required C11 features

```



This shouldn't happen. Do you any custom CC, CPPFLAGS, CFLAGS, LDFLAGS
set?


I‘m getting

´´´
Loading far side box...
F: [ 5] Enter load_box, [1,inf] (find >= 0, paired <= 4294967295, new > 0)
=
==20988==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62a8a979 at 
pc 0x650d7c30 bp 0x7fe47f64 sp 0x7fe47b28
WRITE of size 10 at 0x62a8a979 thread T0
ASAN:DEADLYSIGNAL
AddressSanitizer: nested bug in the same thread, aborting.
´´´



ASAN:DEADLYSIGNAL indicates some kind of severe issue. The sanitizer
should've produced a call-trace instead of that.

I've not been able to reproduce this at all even with 3 servers (2
providers and 1 local [dovecot +COMPRESS]) on 9.3_STABLE/amd64.

Can you try with the patch below. Compile isync-1.4.4 like this:

```
unset CC
export CFLAGS="-O0 -g -fsanitize=address"
export CPPFLAGS=-I/usr/pkg/include
export LDFLAGS="-L/usr/pkg/lib -Wl,-rpath=/usr/pkg/lib"
tar -xf /tmp/isync-1.4.4.tar.gz
mkdir build-isync-1.4.4
cd build-isync-1.4.4
../isync-1.4.4/configure --prefix=/tmp/I
make
make install
```
This create a non-PIE debug executable which you can run/debug after
setting ASLR off: `sysctl -w security.pax.aslr.enabled=0'

See if the sanitizer error goes away and you get a proper call-trace.
As it is now, I doubt we can use that PC address (0x650d7c30) in GDB
and get a correct code (l)isting: it will most likely be in ASAN itself.

---START---
diff -urN isync-1.4.4.orig/src/drv_imap.c isync-1.4.4/src/drv_imap.c
--- isync-1.4.4.orig/src/drv_imap.c 2021-12-03 10:56:16.0 +
+++ isync-1.4.4/src/drv_imap.c  2022-11-07 21:57:49.646386142 +
@@ -2469,7 +2469,10 @@

cmd = new_imap_cmd( sizeof(*cmd) );
cmd->param.cont = do_sasl_auth;
-   imap_exec( ctx, cmd, done_sasl_auth, enc ? "AUTHENTICATE %s %s" : 
"AUTHENTICATE %s", gotmech, enc );
+   if (enc)
+   imap_exec( ctx, cmd, done_sasl_auth, "AUTHENTICATE %s 
%s", gotmech, enc );
+   else
+   imap_exec( ctx, cmd, done_sasl_auth, "AUTHENTICATE %s", 
gotmech );
free( enc );
return;
  notsasl:
diff -urN isync-1.4.4.orig/src/util.c isync-1.4.4/src/util.c
--- isync-1.4.4.orig/src/util.c 2021-12-03 10:56:16.0 +
+++ isync-1.4.4/src/util.c  2022-11-07 22:08:45.526920483 +
@@ -353,6 +353,7 @@
if (blen <= 0 || (uint)(ret = vsnprintf( buf, (size_t)blen, fmt, va )) 
>= (uint)blen)
oob();
va_end( va );
+   assert(ret >= 0);/* XXX: paranoia */
return ret;
 }

@@ -368,6 +369,8 @@
 {
void *ret;

+   if (sz == 0)
+   return NULL;/* XXX: avoid undefined behaviour */
if (!(ret = malloc( sz )))
oom();
return ret;
@@ -378,6 +381,8 @@
 {
void *ret;

+   if (sz == 0)
+   return NULL;/* XXX: avoid undefined behaviour */
if (!(ret = calloc( sz, 1 )))
oom();
return ret;
@@ -388,6 +393,11 @@
 {
char *ret;

+   if (sz == 0) {  /* XXX: ape glibc behaviour */
+   if (mem)
+   free(mem);
+   return NULL;
+   }
    if (!(ret = realloc( mem, sz )) && sz)
oom();
return ret;
---END---

-RVP

Re: can not download IMAP messages with isync/mbsync

2022-11-05 Thread RVP

On Fri, 4 Nov 2022, Marko Bauhardt wrote:


I want to use isync (mbsync) on netbsd to download my mails from my IMAP 
account. isync with the same configuration works fine on OSX and linux, but 
fails on netbsd.

There is already a discussion on

* https://sourceforge.net/p/isync/bugs/64/
* 
https://sourceforge.net/p/isync/mailman/isync-devel/thread/YqcwQSVfaiuGLkhf%40ugly



Does this occur if you compile isync with `--without-zlib'? I tried with 2
servers (neither supporting compression) and couldn't reproduce this.


Do you have any suggestion how do you debug the memory on netbsd? Or is anyone 
from you using mbsync/isync on netbsd?



Try compiling with `-fsanitize=address -g -O0'

-RVP


  1   2   3   4   >