NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/60810: /usr/src/sys/conf/osrelease.h -s behavior does not match description



    Date:        Mon, 28 Sep 2026 17:22:40 -0400
    From:        Rob Whitlock <rwhitlock22%gmail.com@localhost>
    Message-ID:  <71D48D05-B535-47BC-A4E5-30F08CB01CA6%gmail.com@localhost>

  | I agree that when the decimal points are printed, then the leading zeros
  | are not necessary. However, I am arguing about the -s MMmmpp case, not
  | the -m MM.mm.pp case.

I understand that, I also saw the modification you proposed.

[ Incidentally, the easy way to convert a 1 digit value N to 0N in sh
  isn't via printf, that's kind of overkill, just

	case $N in
	[0-9])  N=0$N;;
	esac

  is all that is needed. And use $( ) for cmd subs, not ` `.]

  | On the other hand, having mm or pp be one
  | digit does change this ability to correctly compare the two versions.

But why would anyone want to be doing that using the output from
osversion.sh ... that is a script never installed anywhere, used
during kernel config to build a new vers.c file for the kernel when
needed.   That usage only uses the script with no args.   I gather
the -k option might be used for module building for that kernel.

Why the other options even exist I have no idea.

Normally, I wouldn't expect it to be used for anything else, what
else would care what kernel source version is in some particular
src directory ?

  | I see it as the same notation used in the synopsis of the date(1)
  | man page, where you have [[[[[[CC]yy]mm]dd]HH]MM[.SS]

But it isn't the same, nothing like that at all.

  | Given that CROSS_OPSYS_VERSION is in the MMmmpp format, and
  | osrelease.sh advertises its -s output as being in the MMmmpp
  | format, it is reasonable for someone to assume that you could
  | take the output of osrelease.sh -s

Sorry, but I wouldn't even expect "someone" to know that osrelease.sh
even exists.   Certainly I wouldn't expect it to be used in anything
even slightly related to pkgsrc (which generally builds for base
versions, NetBSD 10.0 (not 10.1 10.2 ...) and wouldn't want the minor
version or patch in any case).

  | That would, however, still leave the problem that a given
  | osrelease.sh -s output does not uniquely specify a particular
  | version, as certain digits could be attributable to multiple
  | fields.

How about we just delete the -s option completely?   It doesn't seem
to be used, or useful.

  | Noted. However, when it appears to be the same format as what another
  | variable (CROSS_OPSYS_VERSION) uses, it can be tempting to use it.

It isn't, CROSS_OPSYS_VERSION for xx.99.yy where yy >= 100 wants
xx.99.99 (xx9999).   osversion.sh uses whatever the comment happens to
claim that the patch number is for the pp part (xx99102).

Just forget osrelease.sh even exists - it isn't a documented part of
NetBSD, just a script that is used to assist with kernel builds.

It hasn't been changed since 2012.   I see no reason to change
anything about it now.

kre





Home | Main Index | Thread Index | Old Index