NetBSD Problem Report #53742

From martin@duskware.de  Sun Nov 25 13:32:03 2018
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 2C8837A172
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 25 Nov 2018 13:32:03 +0000 (UTC)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: src/etc/MAKEDEV.tmpl rev 1.196 has duplicate case label
X-Send-Pr-Version: 3.95

>Number:         53742
>Category:       bin
>Synopsis:       src/etc/MAKEDEV.tmpl rev 1.196 has duplicate case pattern
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 25 13:35:00 +0000 2018
>Last-Modified:  Mon Nov 26 05:20:00 +0000 2018
>Originator:     Martin Husemann
>Release:        NetBSD 8.99.26
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD night-owl.duskware.de 8.99.26 NetBSD 8.99.26 (NIGHT-OWL) #629: Mon Nov 19 06:49:23 CET 2018 martin@night-owl.duskware.de:/usr/src/sys/arch/amd64/compile/NIGHT-OWL amd64
Architecture: x86_64
Machine: amd64
>Description:

There is a duplicate switch case pattern "apm)" in etc/MAKEDEV.tmpl.
I have no idea how sh(1) resolves this (I guess by always using the first,
so the second is dead code) or how it is supposed to work, but
we should either comment it properly or avoid it.

>How-To-Repeat:
Code inspection

>Fix:
n/a

>Audit-Trail:
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/53742: src/etc/MAKEDEV.tmpl rev 1.196 has duplicate case label
Date: Mon, 26 Nov 2018 12:15:18 +0700

     Date:        Sun, 25 Nov 2018 13:35:00 +0000 (UTC)
     From:        martin@NetBSD.org
     Message-ID:  <20181125133500.2B1617A1CB@mollari.NetBSD.org>

   | There is a duplicate switch case pattern "apm)" in etc/MAKEDEV.tmpl.
   | I have no idea how sh(1) resolves this (I guess by always using the first,

 Yes, that's even specified.   Case patterns are examined from first
 to last, and the first that matches wins.   If two are identical, either
 they both match (in which case the first will match before the 2nd
 gets a chance) or neither do (in which case the dup is irrelevant).

   | so the second is dead code) or how it is supposed to work, but
   | we should either comment it properly or avoid it.

 What is there now cannot work, or be useful, the 2nd one (the
 one intended for hpcmips according to its comment) might just
 as well be deleted (or renamed hpapm or something).

 But I suspect ta better solution, is that the second apm entry
 should be moved from src/etc/MAKEDEV.tmpl to
 src/etc/etc.hpcmips/MAKEDEV.conf

 Then when MAKEDEV is constructed, that one will be insterted
 ahead of the MAKEDEV.tmpl one, and override it (using the shell
 behaviour) ... hpcmpis will get its special case, and all other arch's
 will just see the normal one (as that's all that will be there).

 That's what looks to have been intended.   I won't make this change
 though, as I don't have an hpcmips to test that it all works properly.

 (I think I have seen other cases where there are similar overrides
 though.)

 Comments describing what is happening (in etc.hpcmips/MAKEDEV.conf)
 would probably also be a good idea.

 kre

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.