Re: [new] sysutils/lsblk

2023-06-22 Thread Stuart Henderson
On 2023/06/22 12:25, Benjamin Stürz wrote:
> Hi,
> 
> On 19.06.23 12:24, Omar Polo wrote:
> > On 2023/06/19 09:09:39 +0200, Benjamin Stürz  
> > wrote:
> > > Hi,
> > > 
> > > sorry if this is getting a little annoying.
> > 
> > sorry, i thought it was already in tree.
> > 
> > I've added MAKE_ENV += CC="${CC}" and imported, thanks!
> 
> I just realized that I left in the mystuff category in sysutils/lsblk.
> Could you please remove it?
> There aren't any other ports with this issue, I already looked.

btw, you shouldn't ever need "mystuff" in CATEGORIES, it is meant to be used
like mystuff/category/portname and that's handled automatically



Re: [new] sysutils/lsblk

2023-06-22 Thread Benjamin Stürz

Hi,

On 19.06.23 12:24, Omar Polo wrote:

On 2023/06/19 09:09:39 +0200, Benjamin Stürz  wrote:

Hi,

sorry if this is getting a little annoying.


sorry, i thought it was already in tree.

I've added MAKE_ENV += CC="${CC}" and imported, thanks!


I just realized that I left in the mystuff category in sysutils/lsblk.
Could you please remove it?
There aren't any other ports with this issue, I already looked.

Thanks,
Benjamin Stürz



Re: [new] sysutils/lsblk

2023-06-22 Thread Omar Polo
On 2023/06/22 12:25:16 +0200, Benjamin Stürz  wrote:
> Hi,
> 
> On 19.06.23 12:24, Omar Polo wrote:
> > On 2023/06/19 09:09:39 +0200, Benjamin Stürz  
> > wrote:
> >> Hi,
> >>
> >> sorry if this is getting a little annoying.
> > 
> > sorry, i thought it was already in tree.
> > 
> > I've added MAKE_ENV += CC="${CC}" and imported, thanks!
> 
> I just realized that I left in the mystuff category in sysutils/lsblk.
> Could you please remove it?
> There aren't any other ports with this issue, I already looked.

Wooops, don't know how I missed it too.  Fixed, thanks!




Re: [new] sysutils/lsblk

2023-06-19 Thread Benjamin Stürz

Hi Paul & @ports,

On 19.06.23 13:59, Paul de Weerd wrote:

Hi Benjamin,

Patience is a difficult virtue ;)

I didn't expect this journey to be almost 2 months long,
especially for a simple tool that just prints which disks you have.
But I think I now have figured out what I need to submit my next port :)


Congrats, your port is in the tree!  Thanks again for working on it
(and for your perseverence).

Thanks to you and everyone who helped me get here.

Thanks again,
Benjamin Stürz



Re: [new] sysutils/lsblk

2023-06-19 Thread Omar Polo
On 2023/06/19 09:09:39 +0200, Benjamin Stürz  wrote:
> Hi,
> 
> sorry if this is getting a little annoying.

sorry, i thought it was already in tree.

I've added MAKE_ENV += CC="${CC}" and imported, thanks!



Re: [new] sysutils/lsblk

2023-06-19 Thread Stuart Henderson

That was an ok.

--
 Sent from a phone, apologies for poor formatting.

On 19 June 2023 08:09:55 Benjamin Stürz  wrote:


Hi,

sorry if this is getting a little annoying.

On 11.06.23 09:34, Stuart Henderson wrote:

On 2023/06/10 23:40, Benjamin Stürz wrote:

Hi,

what should I do next?
I have at least 2 OKs now, but I don't have any commit rights.


I only count 1 developer ok so far (op@).

I'll add my ok but I'd prefer to add something like this to DESCR:

Could you please consider OKing, if it works for you?


Because it accesses the raw disk devices, it must be run as root.


Best regards,
Benjamin Stürz




Re: [new] sysutils/lsblk

2023-06-19 Thread Benjamin Stürz

Hi,

sorry if this is getting a little annoying.

On 11.06.23 09:34, Stuart Henderson wrote:

On 2023/06/10 23:40, Benjamin Stürz wrote:

Hi,

what should I do next?
I have at least 2 OKs now, but I don't have any commit rights.


I only count 1 developer ok so far (op@).

I'll add my ok but I'd prefer to add something like this to DESCR:

Could you please consider OKing, if it works for you?


Because it accesses the raw disk devices, it must be run as root.


Best regards,
Benjamin Stürz



Re: [new] sysutils/lsblk

2023-06-14 Thread Paul de Weerd
I've tested 1.2.4 and it works well for me; thanks again Benjamin!

Paul

On Thu, Jun 08, 2023 at 10:44:12PM +0200, Benjamin Stürz wrote:
| Hi Laurent,
| 
| On 31.05.23 15:29, Laurent Cheylus wrote:
| > On Tue, 30 May 2023 17:28:00 +0200, Benjamin Stürz wrote:
| > 
| > > lsblk(8) is a simple tool to list attached block devices.
| > > This specifically is a clone of the one in util-linux.
| > > 
| > > This is actually my second attempt of submitting this port.
| > > This time I reworked most of it, fixed all bugs (hopefully :),
| > > incorporated feedback, added a few options and a manual,
| > > and added support for RAID through bio(4).
| > 
| > NOK, lsblk SegFault on openbsd-current/amd64 (VM with VirtualBox on Linux/
| > Debian)
| > 
| > $ doas /usr/obj/ports/lsblk-1.2.3/fake-amd64/usr/local/sbin/lsblk
| > Segmentation fault
| I have finally gotten OpenBSD on VirtualBox working and found the bug:
| lsblk allocated space for only n-1 drives and for some reason,
| probably because of the malloc changes in -current,
| only now this issue caused crashs.
| 
| I have attached a new version of lsblk.
| 
| Thanks,
| Benjamin Stürz



-- 
>[<++>-]<+++.>+++[<-->-]<.>+++[<+
+++>-]<.>++[<>-]<+.--.[-]
 http://www.weirdnet.nl/ 



Re: [new] sysutils/lsblk

2023-06-11 Thread Theo de Raadt
Stuart Henderson  wrote:

> On 2023/06/11 12:56, Benjamin Stürz wrote:
> > On 11.06.23 09:34, Stuart Henderson wrote:
> > > On 2023/06/10 23:40, Benjamin Stürz wrote:
> > > > Hi,
> > > > 
> > > > what should I do next?
> > > > I have at least 2 OKs now, but I don't have any commit rights.
> > > 
> > > I only count 1 developer ok so far (op@).
> > 
> > Sorry, I thought
> > >  Build and tests OK on current/amd64 in a VM on VirtualBox.
> > by Laurent Cheylus  also counted as an ok.
> 
> Only developer OKs count for that.

In OpenBSD, and "ok" is a formal statement made in a commit message to
indicate both review & shared responsibility.  The latter means, if an
an error is introduced, such persons are equally responsible to handle
the in-tree details such as potentially backing it out, further fixing
etc.  In addition, it also causes the commit log to track people who are
familiar with a particular subsystem.  In the future, this can suggest who
should see changes there, without throwing diffs into void and hoping for
an answer.
 



Re: [new] sysutils/lsblk

2023-06-11 Thread Stuart Henderson
On 2023/06/11 12:56, Benjamin Stürz wrote:
> On 11.06.23 09:34, Stuart Henderson wrote:
> > On 2023/06/10 23:40, Benjamin Stürz wrote:
> > > Hi,
> > > 
> > > what should I do next?
> > > I have at least 2 OKs now, but I don't have any commit rights.
> > 
> > I only count 1 developer ok so far (op@).
> 
> Sorry, I thought
> >  Build and tests OK on current/amd64 in a VM on VirtualBox.
> by Laurent Cheylus  also counted as an ok.

Only developer OKs count for that.

> > I'll add my ok but I'd prefer to add something like this to DESCR:
> > 
> > Because it accesses the raw disk devices, it must be run as root.
> 
> New tarball attached.
> New DESCR:
> Show information about block devices that are attached to the system,
> including name, size, type, and information about the disklabel on them,
> such as name, size, type, and mount point of each partition.
> Because it accesses the raw disk devices, it must be run as root.
> 
> This is an incompatible clone of util-linux's lsblk(8) for OpenBSD.




Re: [new] sysutils/lsblk

2023-06-11 Thread Benjamin Stürz

On 11.06.23 09:34, Stuart Henderson wrote:

On 2023/06/10 23:40, Benjamin Stürz wrote:

Hi,

what should I do next?
I have at least 2 OKs now, but I don't have any commit rights.


I only count 1 developer ok so far (op@).


Sorry, I thought

 Build and tests OK on current/amd64 in a VM on VirtualBox.

by Laurent Cheylus  also counted as an ok.


I'll add my ok but I'd prefer to add something like this to DESCR:

Because it accesses the raw disk devices, it must be run as root.


New tarball attached.
New DESCR:
Show information about block devices that are attached to the system,
including name, size, type, and information about the disklabel on them,
such as name, size, type, and mount point of each partition.
Because it accesses the raw disk devices, it must be run as root.

This is an incompatible clone of util-linux's lsblk(8) for OpenBSD.

lsblk-1.2.4.tgz
Description: Binary data


Re: [new] sysutils/lsblk

2023-06-11 Thread Stuart Henderson
On 2023/06/10 23:40, Benjamin Stürz wrote:
> Hi,
> 
> what should I do next?
> I have at least 2 OKs now, but I don't have any commit rights.

I only count 1 developer ok so far (op@).

I'll add my ok but I'd prefer to add something like this to DESCR:

Because it accesses the raw disk devices, it must be run as root.



Re: [new] sysutils/lsblk

2023-06-10 Thread Benjamin Stürz

Hi,

what should I do next?
I have at least 2 OKs now, but I don't have any commit rights.
Could someone import lsblk into the ports tree?

Thanks,
Benjamin Stürz

On 09.06.23 09:19, Laurent Cheylus wrote:

On Thu, 8 Jun 2023 22:44:12 +0200, Benjamin Stürz wrote:


I have finally gotten OpenBSD on VirtualBox working and found the bug:
lsblk allocated space for only n-1 drives and for some reason, probably
because of the malloc changes in -current,
only now this issue caused crashs.

I have attached a new version of lsblk.


Build and tests OK on current/amd64 in a VM on VirtualBox.

$ lsblk -V
lsblk-1.2.4

$ doas lsblk
NAME   SIZE TYPE COMMENT
wd0 40G ESDI/IDE VBOX HARDDISK
├─wd0a 1.0G 4.2BSD   /
├─wd0b 2.2G swap
├─wd0c  40G unused
├─wd0d 2.4G 4.2BSD   /tmp
├─wd0e 3.9G 4.2BSD   /var
├─wd0f 4.4G 4.2BSD   /usr
├─wd0g 1.0G 4.2BSD   /usr/X11R6
├─wd0h 5.4G 4.2BSD   /usr/local
├─wd0i 1.8G 4.2BSD   /usr/src
├─wd0j 6.0G 4.2BSD   /usr/obj
└─wd0k  11G 4.2BSD   /home

Thanks for the fix.

Laurent


lsblk-1.2.4.tgz
Description: application/compressed-tar


Re: [new] sysutils/lsblk

2023-06-08 Thread Benjamin Stürz

Hi Laurent,

On 31.05.23 15:29, Laurent Cheylus wrote:

On Tue, 30 May 2023 17:28:00 +0200, Benjamin Stürz wrote:


lsblk(8) is a simple tool to list attached block devices.
This specifically is a clone of the one in util-linux.

This is actually my second attempt of submitting this port.
This time I reworked most of it, fixed all bugs (hopefully :),
incorporated feedback, added a few options and a manual,
and added support for RAID through bio(4).


NOK, lsblk SegFault on openbsd-current/amd64 (VM with VirtualBox on Linux/
Debian)

$ doas /usr/obj/ports/lsblk-1.2.3/fake-amd64/usr/local/sbin/lsblk
Segmentation fault

I have finally gotten OpenBSD on VirtualBox working and found the bug:
lsblk allocated space for only n-1 drives and for some reason,
probably because of the malloc changes in -current,
only now this issue caused crashs.

I have attached a new version of lsblk.

Thanks,
Benjamin Stürz

lsblk-1.2.4.tgz
Description: Binary data


Re: [new] sysutils/lsblk

2023-05-31 Thread Stuart Henderson
On 2023/05/31 19:12, Benjamin Stürz wrote:
> On 31.05.23 15:29, Laurent Cheylus wrote:
> > On Tue, 30 May 2023 17:28:00 +0200, Benjamin Stürz wrote:
> > 
> > > lsblk(8) is a simple tool to list attached block devices.
> > > This specifically is a clone of the one in util-linux.
> > > 
> > > This is actually my second attempt of submitting this port.
> > > This time I reworked most of it, fixed all bugs (hopefully :),
> > > incorporated feedback, added a few options and a manual,
> > > and added support for RAID through bio(4).
> > 
> > NOK, lsblk SegFault on openbsd-current/amd64 (VM with VirtualBox on Linux/
> > Debian)
> > 
> > $ doas /usr/obj/ports/lsblk-1.2.3/fake-amd64/usr/local/sbin/lsblk
> > Segmentation fault
> While trying to install OpenBSD 7.3 on VirtualBox,
> I can't get past "Installing bsd".
> I get a "fatal protection fault in supervisor mode" in OpenBSD.
> Essentially a kernel panic, after which it reboots.
> I'm trying this on Fedora 38.
> 
> Unfortunately I can't reproduce your error.
> Could you please run with gdb and tell me where it breaks?
> Or better send me a core dump.

Sending core dumps are problematic, you won't have matching libc due to
the boot-time reordering.


> > Excerpt of my dmesg: only one disk wd0
> > 
> > OpenBSD 7.3-current (GENERIC) #1143: Mon May 22 08:36:54 MDT 2023
> >  dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC
> > real mem = 2130640896 (2031MB)
> > avail mem = 2046590976 (1951MB)
> > random: good seed from bootblocks
> > mpath0 at root
> > scsibus0 at mpath0: 256 targets
> > mainbus0 at root
> > bios0 at mainbus0: SMBIOS rev. 2.5 @ 0xe1000 (10 entries)
> > bios0: vendor innotek GmbH version "VirtualBox" date 12/01/2006
> > bios0: innotek GmbH VirtualBox
> > acpi0 at bios0: ACPI 4.0
> > acpi0: sleep states S0 S5
> > acpi0: tables DSDT FACP APIC SSDT
> > acpi0: wakeup devices
> > acpitimer0 at acpi0: 3579545 Hz, 32 bits
> > acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
> > cpu0 at mainbus0: apid 0 (boot processor)
> > cpu0: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz, 3399.94 MHz, 06-3c-03
> > cpu0:
> > FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,CX16,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,RDRAND,NXE,RDTSCP,LONG,LAHF,ABM,ITSC,FSGSBASE,BMI1,AVX2,BMI2,INVPCID,MELTDOWN
> > cpu0: 32KB 64b/line 8-way D-cache, 32KB 64b/line 8-way I-cache, 256KB 64b/
> > line 8-way L2 cache, 8MB 64b/line 16-way L3 cache
> > cpu0: smt 0, core 0, package 0
> > (...)
> > cpu0: using Broadwell MDS workaround
> > pci0 at mainbus0 bus 0
> > pchb0 at pci0 dev 0 function 0 "Intel 82441FX" rev 0x02
> > pcib0 at pci0 dev 1 function 0 "Intel 82371SB ISA" rev 0x00
> > pciide0 at pci0 dev 1 function 1 "Intel 82371AB IDE" rev 0x01: DMA,
> > channel 0 configured to compatibility, channel 1 configured to
> > compatibility
> > wd0 at pciide0 channel 0 drive 0: 
> > wd0: 128-sector PIO, LBA, 40960MB, 83886080 sectors
> > wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
> > 
> > Laurent
> > 
> 



Re: [new] sysutils/lsblk

2023-05-31 Thread Benjamin Stürz

On 31.05.23 15:29, Laurent Cheylus wrote:

On Tue, 30 May 2023 17:28:00 +0200, Benjamin Stürz wrote:


lsblk(8) is a simple tool to list attached block devices.
This specifically is a clone of the one in util-linux.

This is actually my second attempt of submitting this port.
This time I reworked most of it, fixed all bugs (hopefully :),
incorporated feedback, added a few options and a manual,
and added support for RAID through bio(4).


NOK, lsblk SegFault on openbsd-current/amd64 (VM with VirtualBox on Linux/
Debian)

$ doas /usr/obj/ports/lsblk-1.2.3/fake-amd64/usr/local/sbin/lsblk
Segmentation fault

While trying to install OpenBSD 7.3 on VirtualBox,
I can't get past "Installing bsd".
I get a "fatal protection fault in supervisor mode" in OpenBSD.
Essentially a kernel panic, after which it reboots.
I'm trying this on Fedora 38.

Unfortunately I can't reproduce your error.
Could you please run with gdb and tell me where it breaks?
Or better send me a core dump.


Excerpt of my dmesg: only one disk wd0

OpenBSD 7.3-current (GENERIC) #1143: Mon May 22 08:36:54 MDT 2023
 dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC
real mem = 2130640896 (2031MB)
avail mem = 2046590976 (1951MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.5 @ 0xe1000 (10 entries)
bios0: vendor innotek GmbH version "VirtualBox" date 12/01/2006
bios0: innotek GmbH VirtualBox
acpi0 at bios0: ACPI 4.0
acpi0: sleep states S0 S5
acpi0: tables DSDT FACP APIC SSDT
acpi0: wakeup devices
acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz, 3399.94 MHz, 06-3c-03
cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,CX16,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,RDRAND,NXE,RDTSCP,LONG,LAHF,ABM,ITSC,FSGSBASE,BMI1,AVX2,BMI2,INVPCID,MELTDOWN
cpu0: 32KB 64b/line 8-way D-cache, 32KB 64b/line 8-way I-cache, 256KB 64b/
line 8-way L2 cache, 8MB 64b/line 16-way L3 cache
cpu0: smt 0, core 0, package 0
(...)
cpu0: using Broadwell MDS workaround
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel 82441FX" rev 0x02
pcib0 at pci0 dev 1 function 0 "Intel 82371SB ISA" rev 0x00
pciide0 at pci0 dev 1 function 1 "Intel 82371AB IDE" rev 0x01: DMA,
channel 0 configured to compatibility, channel 1 configured to
compatibility
wd0 at pciide0 channel 0 drive 0: 
wd0: 128-sector PIO, LBA, 40960MB, 83886080 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2

Laurent





Re: [new] sysutils/lsblk

2023-05-31 Thread Omar Polo
On 2023/05/30 19:33:11 +0200, Benjamin Stürz  wrote:
> > The port itself looks fine to me, except for the permissions of
> > distinfo and PLIST... All files should be 0644 and directories 0755.
> Fixed, the problem was my umask of 027.
> 
> > No need to send an updated tarball just for this however, whoever will
> > import it can easily fix it.
> Did it anyway + for the reasons below.
> 
> > 
> > OK op@ to import with perms fixed.
> > 
> > Now, some misc nits that don't really affect the port:
> > 
> >   - you could set yourself as MAINTAINER for the port.  It is not
> > required of course, but seems you seem to be the upstream too
> > you're qualified enough I'd say ;-)
> Done
> 
> >   - I'd drop -Werror from release tarballs.  While it is super-useful
> > during development, it is a super-pita for packagers when the C
> > compiler gets updated.
> Done

still ok op@ to import.

Thank you!



Re: [new] sysutils/lsblk

2023-05-30 Thread Benjamin Stürz

On 30.05.23 20:00, Dave Voutila wrote:


Benjamin Stürz  writes:


Hi Omar,

On 30.05.23 19:03, Omar Polo wrote:

Hello,
I remember that when I started using OpenBSD I kind of missed
lsblk...
Now I wouldn't look back probably, but it could be nice for newcommers
(at least :-)

Yeah, that's the reason why I made this tool.
Using sysctl + disklabel + df is a little annoying.


Bummer that it needs superuser privileges to show the list, but I
haven't looked at how it's implemented so don't know.

Actually if you do
# chgrp operator /usr/local/sbin/lsblk
# chmod g+s /usr/local/sbin/lslbk


Adding a setguid program even in ports seems like a bad idea to me.

There isn't anything related to set*id in the program nor the port.
Exceptions: the README and the *optional* `make unroot` rule.
But I thought the same, so I didn't `make unroot` in the port.

Explanation:
It just so happens that if your (egid == operator),
that you have read-only access to disk devices in /dev,
allowing you to read the disklabel(5) and use bio(4).

IMO if you want to follow OpenBSD's principle of least privilege,
you should follow my steps and not run it as root instead,
since root has read-write access to everything in /dev.

My lsblk does utilize pledge(2) & unveil(2) and opendev(3)s things with
only O_RDONLY set, so it should be safe enough (I guess).



or
# make unroot
you can run it as a normal user.

But I didn't know if I should include it in the port.


The port itself looks fine to me, except for the permissions of
distinfo and PLIST... All files should be 0644 and directories 0755.

Fixed, the problem was my umask of 027.


No need to send an updated tarball just for this however, whoever will
import it can easily fix it.

Did it anyway + for the reasons below.


OK op@ to import with perms fixed.
Now, some misc nits that don't really affect the port:
   - you could set yourself as MAINTAINER for the port.  It is not
 required of course, but seems you seem to be the upstream too
 you're qualified enough I'd say ;-)

Done


   - I'd drop -Werror from release tarballs.  While it is super-useful
 during development, it is a super-pita for packagers when the C
 compiler gets updated.

Done

Best regards,
Benjamin Stürz

[2. application/octet-stream; lsblk-1.2.3.tgz]...




Re: [new] sysutils/lsblk

2023-05-30 Thread Paul de Weerd
I've been trying several development versions of this, and now the
port.  It's working well for me .. would be nice to have this in the
tree!

Paul

On Tue, May 30, 2023 at 05:28:00PM +0200, Benjamin Stürz wrote:
| Hi ports@,
| 
| lsblk(8) is a simple tool to list attached block devices.
| This specifically is a clone of the one in util-linux.
| 
| This is actually my second attempt of submitting this port.
| This time I reworked most of it, fixed all bugs (hopefully :),
| incorporated feedback, added a few options and a manual,
| and added support for RAID through bio(4).
| I think it's ready for submission into the ports tree.
| 
| I don't have any commit rights,
| so if you are interested in committing this,
| please let me know.
| 
| Testing and comments are appreciated.
| 
| WWW: https://git.stuerz.xyz/openbsd/lsblk
| 
| Best regards,
| Benjamin Stürz



-- 
>[<++>-]<+++.>+++[<-->-]<.>+++[<+
+++>-]<.>++[<>-]<+.--.[-]
 http://www.weirdnet.nl/ 



Re: [new] sysutils/lsblk

2023-05-30 Thread Dave Voutila


Benjamin Stürz  writes:

> Hi Omar,
>
> On 30.05.23 19:03, Omar Polo wrote:
>> Hello,
>> I remember that when I started using OpenBSD I kind of missed
>> lsblk...
>> Now I wouldn't look back probably, but it could be nice for newcommers
>> (at least :-)
> Yeah, that's the reason why I made this tool.
> Using sysctl + disklabel + df is a little annoying.
>
>> Bummer that it needs superuser privileges to show the list, but I
>> haven't looked at how it's implemented so don't know.
> Actually if you do
> # chgrp operator /usr/local/sbin/lsblk
> # chmod g+s /usr/local/sbin/lslbk

Adding a setguid program even in ports seems like a bad idea to me.

> or
> # make unroot
> you can run it as a normal user.
>
> But I didn't know if I should include it in the port.
>
>> The port itself looks fine to me, except for the permissions of
>> distinfo and PLIST... All files should be 0644 and directories 0755.
> Fixed, the problem was my umask of 027.
>
>> No need to send an updated tarball just for this however, whoever will
>> import it can easily fix it.
> Did it anyway + for the reasons below.
>
>> OK op@ to import with perms fixed.
>> Now, some misc nits that don't really affect the port:
>>   - you could set yourself as MAINTAINER for the port.  It is not
>> required of course, but seems you seem to be the upstream too
>> you're qualified enough I'd say ;-)
> Done
>
>>   - I'd drop -Werror from release tarballs.  While it is super-useful
>> during development, it is a super-pita for packagers when the C
>> compiler gets updated.
> Done
>
> Best regards,
> Benjamin Stürz
>
> [2. application/octet-stream; lsblk-1.2.3.tgz]...



Re: [new] sysutils/lsblk

2023-05-30 Thread Benjamin Stürz

Hi Omar,

On 30.05.23 19:03, Omar Polo wrote:

Hello,

I remember that when I started using OpenBSD I kind of missed lsblk...
Now I wouldn't look back probably, but it could be nice for newcommers
(at least :-)

Yeah, that's the reason why I made this tool.
Using sysctl + disklabel + df is a little annoying.



Bummer that it needs superuser privileges to show the list, but I
haven't looked at how it's implemented so don't know.

Actually if you do
# chgrp operator /usr/local/sbin/lsblk
# chmod g+s /usr/local/sbin/lslbk
or
# make unroot
you can run it as a normal user.

But I didn't know if I should include it in the port.



The port itself looks fine to me, except for the permissions of
distinfo and PLIST... All files should be 0644 and directories 0755.

Fixed, the problem was my umask of 027.


No need to send an updated tarball just for this however, whoever will
import it can easily fix it.

Did it anyway + for the reasons below.



OK op@ to import with perms fixed.

Now, some misc nits that don't really affect the port:

  - you could set yourself as MAINTAINER for the port.  It is not
required of course, but seems you seem to be the upstream too
you're qualified enough I'd say ;-)

Done


  - I'd drop -Werror from release tarballs.  While it is super-useful
during development, it is a super-pita for packagers when the C
compiler gets updated.

Done

Best regards,
Benjamin Stürz

lsblk-1.2.3.tgz
Description: Binary data


Re: [new] sysutils/lsblk

2023-05-30 Thread Omar Polo
Hello,

On 2023/05/30 17:28:00 +0200, Benjamin Stürz  wrote:
> Hi ports@,
> 
> lsblk(8) is a simple tool to list attached block devices.
> This specifically is a clone of the one in util-linux.
> 
> This is actually my second attempt of submitting this port.
> This time I reworked most of it, fixed all bugs (hopefully :),
> incorporated feedback, added a few options and a manual,
> and added support for RAID through bio(4).
> I think it's ready for submission into the ports tree.
> 
> I don't have any commit rights,
> so if you are interested in committing this,
> please let me know.
> 
> Testing and comments are appreciated.
> 
> WWW: https://git.stuerz.xyz/openbsd/lsblk

I remember that when I started using OpenBSD I kind of missed lsblk...
Now I wouldn't look back probably, but it could be nice for newcommers
(at least :-)

Bummer that it needs superuser privileges to show the list, but I
haven't looked at how it's implemented so don't know.

The port itself looks fine to me, except for the permissions of
distinfo and PLIST... All files should be 0644 and directories 0755.
No need to send an updated tarball just for this however, whoever will
import it can easily fix it.

OK op@ to import with perms fixed.

Now, some misc nits that don't really affect the port:

 - you could set yourself as MAINTAINER for the port.  It is not
   required of course, but seems you seem to be the upstream too
   you're qualified enough I'd say ;-)

 - I'd drop -Werror from release tarballs.  While it is super-useful
   during development, it is a super-pita for packagers when the C
   compiler gets updated.


Cheers,

Omar Polo



Re: [new] sysutils/lsblk

2023-05-18 Thread Benjamin Stürz

Hi ports@,

I have reworked my lsblk(8) clone a lot.
Now it has a little man page and a few options (mainly -a).
It also works with RAID devices (only softraid(4) tested).

I don't have any commit rights,
so if you are interested in committing this, please let me know.

Comments and testing are still appreciated,
especially if you have an exotic disk-setup,
like multiple RAIDs that aren't all softraid(4).

Since I switched to OpenBSD,
it has always been a little pain in the ass for me
to use the sysctl hw.disknames, disklabel, etc sequence.
This port is meant to address this in a nice way.

WWW: https://git.stuerz.xyz/openbsd/lsblk

Best regards,
Benjamin Stürz

On 30.04.23 20:58, Benjamin Stürz wrote:

Hello,

this my first time submitting a port to OpenBSD.

DESCR: Clone of util-linux's lsblk(8) for OpenBSD.

I have tested it on amd64 and it works with my SATA SSD and USB HDD. 
Please test it on your hardware and give me feedback.

Unfortunately it requires root permissions, but a workaround would be to:
# chgrp operator /usr/local/sbin/lsblk
# chmod g+s /usr/local/sbin/lsblk

If you have any ideas for improvement, please let me know.

Best regards,
Benjamin Stürz


lsblk-1.2.tgz
Description: Binary data


Re: [new] sysutils/lsblk

2023-05-01 Thread Benjamin Stürz

On 01.05.23 15:34, Stuart Henderson wrote:

That seems better to me. But... an _incompatible_ clone


I wrote "incompatible", because it doesn't support all the options of 
the original lsblk(8). It also doesn't print exactly the same output as 
the original. That's why it's incompatible (from my perspective).
If I'll ever reach the point of full compatibility, I'll drop the 
"incompatible", but I don't think it's necessary, since most people only 
write `lsblk`, without any options.




does that really give us more than df -h


df shows the mounted filesystems.
lsblk shows the attached block devices.
There's a difference:
1. Not all attached block devices are mounted
2. Not all mounted filesystems are on a block device
3. df doesn't show the partition size, it shows the filesystem size 
(they can be different)

4. df doesn't show the type of the filesystem
5. df doesn't show swap partitions


The main reason for writing lsblk was to make it easier to find _which_ 
device to mount, not to replace df.

If you want to know the filesystem usage, use df.

I know that `sysctl hw.disknames` can be used to see all block devices 
(that's what lsblk uses), but it doesn't show any other information 
about the device. You'd have to do `disklabel dev` afterwards, which is 
a little cumbersome.


Another reason to use lsblk over disklabel is that lsblk scales the 
values automatically, while disklabel requires `-p unit`.



Best regards,
Benjamin Stürz



Re: [new] sysutils/lsblk

2023-05-01 Thread Stuart Henderson
On 2023/05/01 14:22, Benjamin Stürz wrote:
> On 01.05.23 12:04, Stuart Henderson wrote:
> > For COMMNT and pkg/DESCR, rather than just saying "clone of X", say what
> > it does.
> > 
> > You can also mention that it's a clone but the main thing about these is
> > to describe what the software does.
> > 
> 
> Do you think this would be more fitting:
> 
> COMMENT = list block devices
> 
> DESCR =
> """
> Show information about block devices that are attached to the system,
> including name, size, type, and information about the disklabel on them,
> such as name, size, type, and mount point of each partition.
> 
> This is an incompatible clone of util-linux's lsblk(8) for OpenBSD.
> """

That seems better to me. But... an _incompatible_ clone - does that
really give us more than df -h?



Re: [new] sysutils/lsblk

2023-05-01 Thread Benjamin Stürz

On 01.05.23 12:04, Stuart Henderson wrote:

For COMMNT and pkg/DESCR, rather than just saying "clone of X", say what
it does.

You can also mention that it's a clone but the main thing about these is
to describe what the software does.



Do you think this would be more fitting:

COMMENT = list block devices

DESCR =
"""
Show information about block devices that are attached to the system,
including name, size, type, and information about the disklabel on them,
such as name, size, type, and mount point of each partition.

This is an incompatible clone of util-linux's lsblk(8) for OpenBSD.
"""


Thanks for your feedback,
Benjamin Stürz

lsblk.tgz
Description: Binary data


Re: [new] sysutils/lsblk

2023-05-01 Thread Benjamin Stürz

On 01.05.23 11:56, Laurent Cheylus wrote:


$ doas lsblk
wd0 40G ESDI/IDE disk
   wd0a 1.0G 4.2BSD /
   wd0b 2.2G swap
   wd0c  40G unused
   wd0d 2.4G 4.2BSD /tmp
   wd0e 3.9G 4.2BSD /var
   wd0f 4.4G 4.2BSD /usr
   wd0g 1.0G 4.2BSD /usr/X11R6
   wd0h 5.4G 4.2BSD /usr/local
   wd0i 1.8G 4.2BSD /usr/src
   wd0j 6.0G 4.2BSD /usr/obj
   wd0k  11G 4.2BSD /home


Thanks for testing.
Looks about right.
In the next version I'm gonna fix the whitespace and add a header.

Best regards,
Benjamin Stürz



Re: [new] sysutils/lsblk

2023-05-01 Thread Stuart Henderson
On 2023/04/30 21:02, Benjamin Stürz wrote:
> On 30.04.23 20:58, Benjamin Stürz wrote:
> > Hello,
> > 
> > this my first time submitting a port to OpenBSD.
> > 
> > DESCR: Clone of util-linux's lsblk(8) for OpenBSD.
> > 
> > I have tested it on amd64 and it works with my SATA SSD and USB HDD.
> > Please test it on your hardware and give me feedback.
> > Unfortunately it requires root permissions, but a workaround would be to:
> > # chgrp operator /usr/local/sbin/lsblk
> > # chmod g+s /usr/local/sbin/lsblk
> > 
> > If you have any ideas for improvement, please let me know.
> > 
> > Best regards,
> > Benjamin Stürz
> 
> Sorry, forgot to attach the tar-ball.

For COMMNT and pkg/DESCR, rather than just saying "clone of X", say what
it does.

You can also mention that it's a clone but the main thing about these is
to describe what the software does.



Re: [new] sysutils/lsblk

2023-04-30 Thread Benjamin Stürz

On 30.04.23 20:58, Benjamin Stürz wrote:

Hello,

this my first time submitting a port to OpenBSD.

DESCR: Clone of util-linux's lsblk(8) for OpenBSD.

I have tested it on amd64 and it works with my SATA SSD and USB HDD. 
Please test it on your hardware and give me feedback.

Unfortunately it requires root permissions, but a workaround would be to:
# chgrp operator /usr/local/sbin/lsblk
# chmod g+s /usr/local/sbin/lsblk

If you have any ideas for improvement, please let me know.

Best regards,
Benjamin Stürz


Sorry, forgot to attach the tar-ball.

lsblk.tgz
Description: Binary data