Project

General

Profile

Bug #4360

Fix SMF methods and other scripts which rely on the system shell to use /sbin/sh

Added by Jim Klimov over 5 years ago. Updated about 5 years ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
2013-11-26
Due date:
% Done:

50%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage

Description

Related to bug #4351 (making /sbin/sh a real program for cases that /usr is a separate filesystem), the system scripts such as SMF methods should use /sbin/sh as their shell. Some of these scripts rely on "#!/bin/sh" shebang, which would fail when /usr is unavailable and /bin is a symlink to "./usr/bin".

A short list of SMF methods to fix just from the default OI installation:

  1. grep /bin/sh /lib/svc/*/*

/lib/svc/method/inetd-upgrade:#! /usr/bin/sh
/lib/svc/method/svc-acpihpd:#!/bin/sh
/lib/svc/method/svc-allocate:#! /bin/sh
/lib/svc/method/svc-consadm:#!/bin/sh
/lib/svc/method/svc-gdm:#!/bin/sh
/lib/svc/method/svc-ipmievd:#!/bin/sh
/lib/svc/method/svc-mdmonitor:#!/bin/sh
/lib/svc/method/svc-metasync:#!/bin/sh
/lib/svc/method/svc-network-discovery:#!/bin/sh
/lib/svc/method/svc-rbac:#! /usr/bin/sh
/lib/svc/method/svc-rdisc:#!/bin/sh
/lib/svc/method/svc-stosreg:#!/bin/sh
/lib/svc/method/svc-zonestat:#!/bin/sh
/lib/svc/method/yp:#!/bin/sh
/lib/svc/share/fs_include.sh:#!/bin/sh
/lib/svc/share/net_include.sh:#!/bin/sh
/lib/svc/share/routing_include.sh:#!/bin/sh
/lib/svc/share/smf_include.sh:#!/bin/sh

Probably there are more in other packages...

History

#1

Updated by Bart Coddens over 5 years ago

  • Status changed from New to In Progress
  • Assignee set to Bart Coddens
  • % Done changed from 0 to 50

I'm working on this

#2

Updated by Bart Coddens over 5 years ago

I did a

fgrep -R '!/bin/sh' . | grep svc > /tmp/output to find all the files that are affected by this bug:

This gives me this:

./cmd/acpihpd/svc-acpihpd:#!/bin/sh
./cmd/cmd-inet/usr.sbin/in.rdisc/svc-rdisc:#!/bin/sh
./cmd/consadm/svc-consadm:#!/bin/sh
./cmd/drd/svc-drd:#!/bin/sh
./cmd/hal/addons/network-devices/svc-network-discovery:#!/bin/sh
./cmd/lvm/md_monitord/svc-mdmonitor.sh:#!/bin/sh
./cmd/lvm/util/svc-metasync:#!/bin/sh
./cmd/oplhpd/svc-oplhpd:#!/bin/sh
./cmd/sckmd/svc-sckmd:#!/bin/sh
./cmd/svc/shell/fs_include.sh:#!/bin/sh
./cmd/svc/shell/net_include.sh:#!/bin/sh
./cmd/svc/shell/routing_include.sh:#!/bin/sh
./cmd/svc/shell/smf_include.sh:#!/bin/sh
./cmd/zonestat/zonestatd/svc-zonestat:#!/bin/sh
./lib/libdscp/svc/svc-dscp:#!/bin/sh
./man/man1/svcprop.1:#!/bin/sh

I left out:
./cmd/svc/common/i.manifest:#!/bin/sh
./cmd/svc/common/r.manifest:#!/bin/sh
./cmd/svc/inc.flg:#!/bin/sh
./cmd/svc/req.flg:#!/bin/sh
./cmd/svc/seed/inc.flg:#!/bin/sh
./lib/libdhcpsvc/private/inc.flg:#!/bin/sh

#3

Updated by Bart Coddens over 5 years ago

Comment from Garrett:

Limit it to just those things that are needed before usr is mounted.

This let me create the dependency graph as follows:

disabled 17:24:40 svc:/network/dns/install:default
disabled 17:24:40 svc:/application/print/server:default
disabled 17:24:42 svc:/network/ipqos:default
online 17:24:43 svc:/system/pfexec:default
online 17:24:44 svc:/system/keymap:default
online 17:24:46 svc:/system/device/local:default
online 17:24:46 svc:/network/ipsec/ipsecalgs:default
online 17:24:46 svc:/system/filesystem/minimal:default
online 17:24:48 svc:/network/initial:default
online 17:24:48 svc:/network/service:default
online 17:24:49 svc:/network/routing-setup:default
online 17:24:52 svc:/network/location:default

#4

Updated by Dan McDonald about 5 years ago

Why is ipsecalgs in that list above? That service doesn't have a method script: it uses ipsecalgs(1M) directly.

Also available in: Atom PDF