Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jul 2014 22:44:01 -0500
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        dteske@FreeBSD.org, "'Mateusz Guzik'" <mjguzik@gmail.com>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r268641 - head/usr.sbin/service
Message-ID:  <53C5F501.1050304@FreeBSD.org>
In-Reply-To: <014901cfa0a0$773c3640$65b4a2c0$@FreeBSD.org>
References:  <201407150218.s6F2Itj8044531@svn.freebsd.org> <53C56BE9.9050304@FreeBSD.org> <20140715191553.GA31990@dft-labs.eu> <014901cfa0a0$773c3640$65b4a2c0$@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 7/15/14, 9:48 PM, dteske@FreeBSD.org wrote:
>
>
>> -----Original Message-----
>> From: owner-src-committers@freebsd.org [mailto:owner-src-
>> committers@freebsd.org] On Behalf Of Mateusz Guzik
>> Sent: Tuesday, July 15, 2014 12:16 PM
>> To: Bryan Drewery
>> Cc: Devin Teske; src-committers@freebsd.org; svn-src-all@freebsd.org; svn-
>> src-head@freebsd.org
>> Subject: Re: svn commit: r268641 - head/usr.sbin/service
>>
>> On Tue, Jul 15, 2014 at 12:59:05PM -0500, Bryan Drewery wrote:
>>> On 7/14/2014 9:18 PM, Devin Teske wrote:
>>>> Author: dteske
>>>> Date: Tue Jul 15 02:18:55 2014
>>>> New Revision: 268641
>>>> URL: http://svnweb.freebsd.org/changeset/base/268641
>>>>
>>>> Log:
>>>>    Fix an issue with service(8) where utilities such as screen(1) and tmux(1)
>>>>    would behave differently when utilizing rc-script was invoked manually
>> vs.
>>>>    service(8). The issue being that these utilities require the TERM environ
>>>>    variable to be set and service(8) was not passing it down.
>>>>
>>>>    Reported by:	Michael Dexter <editor@callfortesting.org>
>>>>    PR:		bin/191869
>>>>    Reviewed by:	allanjude
>>>>    MFC after:	3 days
>>>>    X-MFC-to:	stable/10, stable/9
>>>>
>>>> Modified:
>>>>    head/usr.sbin/service/service.sh
>>>>
>>>> Modified: head/usr.sbin/service/service.sh
>>>>
>> ==========================================================
>> ====================
>>>> --- head/usr.sbin/service/service.sh	Tue Jul 15 01:03:29 2014
>> 	(r268640)
>>>> +++ head/usr.sbin/service/service.sh	Tue Jul 15 02:18:55 2014
>> 	(r268641)
>>>> @@ -139,7 +139,7 @@ cd /
>>>>   for dir in /etc/rc.d $local_startup; do
>>>>   	if [ -x "$dir/$script" ]; then
>>>>   		[ -n "$VERBOSE" ] && echo "$script is located in $dir"
>>>> -		exec env -i HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin
>> $dir/$script $*
>>>> +		exec env -i HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin
>> TERM="$TERM" $dir/$script $*
>>>>   	fi
>>>>   done
>>>>
>>>>
>>>
>>> Hm, I'm not sure about this. The "behaves differently" is exactly the
>>> reason for service(8). It runs with a clean environment such as the boot
>>> does. Running an rc script without service(8) will give wrong behavior
>>> in many scripts that do not match boot-time behavior.
>>>
>>
>> Indeed, the whole point is to NOT inherit anything from calling process.
>>
>
> If that were the point, then we have an issue. Because as it stands,
> service(8) does _not_ accurately provide the same environment as boot.
>
> Take the following boot script:
>
> dteske@scribe9.vicor.com ~ $ cat /etc/rc.d/foo
> #!/bin/sh
> # PROVIDE: foo
> set > /tmp/termtest
> . /etc/rc.subr
> name=foo
> rcvar=foo_enable
> command="/usr/local/bin/tmux"
> foo_flags="new -s foo ls"
> load_rc_config $name
> run_rc_command "$1"
>
> Now reboot to find the following in /tmp/termtest:
>
> dteske@scribe9.vicor.com ~ $ cat /tmp/termtest
> HOME=/
> ID=/usr/bin/id
> IDCMD='if [ -x /usr/bin/id ]; then /usr/bin/id -un; fi'
> IFS='
> '
> JID=0
> OPTIND=1
> PATH=/sbin:/bin:/usr/sbin:/usr/bin
> PPID=1
> PS1='# '
> PS2='> '
> PS4='+ '
> PS='/bin/ps -ww'
> PWD=/
> RC_PID=19
> SYSCTL=/sbin/sysctl
> SYSCTL_N='/sbin/sysctl -n'
> SYSCTL_W=/sbin/sysctl
> _arg=faststart
> _boot=faststart
> _file=/etc/rc.d/foo
> _rc_conf_loaded=true
> _rc_elem=/etc/rc.d/foo
> _rc_elem_done=' /etc/rc.d/sysctl /etc/rc.d/hostid /etc/rc.d/zvol /etc/rc.d/dumpon /etc/rc.d/ddb /etc/rc.d/initrandom /etc/rc.d/geli /etc/rc.d/gbde /etc/rc.d/encswap /etc/rc.d/ccd /etc/rc.d/swap1 /etc/rc.d/fsck /etc/rc.d/root /etc/rc.d/mdconfig /etc/rc.d/hostid_save /etc/rc.d/mountcritlocal /etc/rc.d/zfs /etc/rc.d/var /etc/rc.d/cleanvar /etc/rc.d/FILESYSTEMS '
> _rc_namevarlist='program chroot chdir flags fib nice user group groups'
> _rc_subr_loaded=:
> accept_sourceroute=NO
> accounting_enable=NO
> allscreens_flags=''
> allscreens_kbdflags=''
> always_force_depends=NO
> amd_enable=NO
> amd_flags='-a /.amd_mnt -l syslog /host /etc/amd.map /net /etc/amd.map'
> amd_map_program=NO
> amd_program=/usr/sbin/amd
> apm_enable=NO
> apmd_enable=NO
> apmd_flags=''
> arpproxy_all=NO
> atm_arps=''
> atm_enable=NO
> atm_pvcs=''
> auditd_enable=NO
> auditd_flags=''
> auditd_program=/usr/sbin/auditd
> auditdistd_enable=NO
> auditdistd_flags=''
> auditdistd_program=/usr/sbin/auditdistd
> autoboot=yes
> background_dhclient=NO
> background_fsck=YES
> background_fsck_delay=60
> bhyve_enable=NO
> bhyve_profiles='virt1 virt2'
> blanktime=300
> bootparamd_enable=NO
> bootparamd_flags=''
> bsdextended_script=/etc/rc.bsdextended
> bsnmpd_enable=NO
> bsnmpd_flags=''
> bthidd_config=/etc/bluetooth/bthidd.conf
> bthidd_enable=NO
> bthidd_hids=/var/db/bthidd.hids
> check_quotas=YES
> chkprintcap_enable=NO
> chkprintcap_flags=-d
> cleanvar_enable=YES
> clear_tmp_X=YES
> clear_tmp_enable=NO
> cloned_interfaces=''
> crashinfo_enable=YES
> crashinfo_program=/usr/sbin/crashinfo
> cron_dst=YES
> cron_enable=YES
> cron_flags=''
> cron_program=/usr/sbin/cron
> cursor=NO
> ddb_config=/etc/ddb.conf
> ddb_enable=NO
> defaultroute_carrier_delay=5
> defaultroute_delay=30
> defaultrouter=172.16.169.2
> devd_enable=YES
> devd_flags=''
> devfs_load_rulesets=NO
> devfs_rulesets='/etc/defaults/devfs.rules /etc/devfs.rules'
> devfs_set_rulesets=''
> devfs_system_ruleset=''
> dhclient_flags=''
> dhclient_program=/sbin/dhclient
> dir=/usr/local/etc/rc.d
> dlv=0
> dmesg_enable=YES
> dummynet_enable=NO
> dumpdev=NO
> dumpdir=/var/crash
> early_late_divider=FILESYSTEMS
> economy_cpu_freq=NONE
> economy_cx_lowest=HIGH
> entropy_dir=/var/db/entropy
> entropy_file=/entropy
> entropy_save_num=8
> entropy_save_sz=2048
> extra_netfs_types=NO
> fec_interfaces=''
> file=/usr/local/etc/rc.d/svnserve
> files='/etc/rc.d/sysctl
> /etc/rc.d/hostid
> /etc/rc.d/zvol
> /etc/rc.d/dumpon
> /etc/rc.d/ddb
> /etc/rc.d/initrandom
> /etc/rc.d/geli
> /etc/rc.d/gbde
> /etc/rc.d/encswap
> /etc/rc.d/ccd
> /etc/rc.d/swap1
> /etc/rc.d/fsck
> /etc/rc.d/root
> /etc/rc.d/mdconfig
> /etc/rc.d/hostid_save
> /etc/rc.d/mountcritlocal
> /etc/rc.d/zfs
> /etc/rc.d/var
> /etc/rc.d/cleanvar
> /etc/rc.d/FILESYSTEMS
> /etc/rc.d/kldxref
> /etc/rc.d/kld
> /etc/rc.d/addswap
> /etc/rc.d/random
> /etc/rc.d/adjkerntz
> /etc/rc.d/atm1
> /etc/rc.d/hostname
> /etc/rc.d/ip6addrctl
> /etc/rc.d/netoptions
> /etc/rc.d/sppp
> /etc/rc.d/ipfilter
> /etc/rc.d/ipnat
> /etc/rc.d/ipfs
> /etc/rc.d/serial
> /etc/rc.d/netif
> /etc/rc.d/devd
> /etc/rc.d/ipsec
> /etc/rc.d/atm2
> /etc/rc.d/pfsync
> /etc/rc.d/pflog
> /etc/rc.d/pf
> /etc/rc.d/stf
> /etc/rc.d/ppp
> /etc/rc.d/faith
> /etc/rc.d/routing
> /etc/rc.d/mroute6d
> /etc/rc.d/nsswitch
> /etc/rc.d/rtsold
> /etc/rc.d/static_ndp
> /etc/rc.d/static_arp
> /etc/rc.d/bridge
> /etc/rc.d/resolv
> /etc/rc.d/route6d
> /etc/rc.d/mrouted
> /etc/rc.d/routed
> /etc/rc.d/defaultroute
> /etc/rc.d/ipfw
> /etc/rc.d/NETWORKING
> /etc/rc.d/netwait
> /etc/rc.d/mountcritremote
> /etc/rc.d/accounting
> /etc/rc.d/ldconfig
> /etc/rc.d/devfs
> /etc/rc.d/ipmon
> /etc/rc.d/mdconfig2
> /etc/rc.d/newsyslog
> /etc/rc.d/syslogd
> /etc/rc.d/watchdogd
> /etc/rc.d/savecore
> /etc/rc.d/archdep
> /etc/rc.d/abi
> /etc/rc.d/SERVERS
> /etc/rc.d/named
> /etc/rc.d/ntpdate
> /etc/rc.d/rpcbind
> /etc/rc.d/nfsclient
> /etc/rc.d/nisdomain
> /etc/rc.d/ypserv
> /etc/rc.d/ypbind
> /etc/rc.d/ypset
> /etc/rc.d/amd
> /etc/rc.d/atm3
> /etc/rc.d/auditd
> /etc/rc.d/auditdistd
> /etc/rc.d/tmp
> /etc/rc.d/cleartmp
> /etc/rc.d/dmesg
> /etc/rc.d/hastd
> /etc/rc.d/ipxrouted
> /etc/rc.d/kerberos
> /etc/rc.d/kadmind
> /etc/rc.d/keyserv
> /etc/rc.d/kpasswdd
> /etc/rc.d/nfsuserd
> /etc/rc.d/gssd
> /etc/rc.d/quota
> /etc/rc.d/mountd
> /etc/rc.d/nfsd
> /etc/rc.d/statd
> /etc/rc.d/lockd
> /etc/rc.d/pppoed
> /etc/rc.d/pwcheck
> /etc/rc.d/virecover
> /usr/local/etc/rc.d/stunnel
> /etc/rc.d/DAEMON
> /usr/local/etc/rc.d/svnserve
> /etc/rc.d/apm
> /etc/rc.d/apmd
> /etc/rc.d/bootparams
> /etc/rc.d/hcsecd
> /etc/rc.d/bthidd
> /etc/rc.d/local
> /etc/rc.d/lpd
> /etc/rc.d/motd
> /etc/rc.d/mountlate
> /etc/rc.d/nscd
> /etc/rc.d/ntpd
> /etc/rc.d/powerd
> /etc/rc.d/rarpd
> /etc/rc.d/rctl
> /etc/rc.d/sdpd
> /etc/rc.d/rfcomm_pppd_server
> /etc/rc.d/rtadvd
> /etc/rc.d/rwho
> /etc/rc.d/timed
> /etc/rc.d/ugidfw
> /etc/rc.d/yppasswdd
> /etc/rc.d/LOGIN
> /usr/local/etc/rc.d/rsyncd
> /usr/local/etc/rc.d/p4d
> /usr/local/etc/rc.d/mcwatchdog
> /usr/local/etc/rc.d/git_daemon
> /usr/local/etc/rc.d/dbus
> /etc/rc.d/ypxfrd
> /etc/rc.d/ypupdated
> /etc/rc.d/ubthidhci
> /etc/rc.d/syscons
> /etc/rc.d/sshd
> /etc/rc.d/sendmail
> /etc/rc.d/cron
> /etc/rc.d/jail
> /etc/rc.d/localpkg
> /etc/rc.d/securelevel
> /etc/rc.d/othermta
> /etc/rc.d/nfscbd
> /etc/rc.d/msgs
> /etc/rc.d/moused
> /etc/rc.d/mixer
> /etc/rc.d/inetd
> /etc/rc.d/hostapd
> /etc/rc.d/gptboot
> /etc/rc.d/geli2
> /etc/rc.d/ftpd
> /etc/rc.d/ftp-proxy
> /etc/rc.d/foo
> /etc/rc.d/bsnmpd
> /etc/rc.d/bgfsck'
> firewall_allowservices=''
> firewall_client_net=192.0.2.0/24
> firewall_coscripts=''
> firewall_enable=NO
> firewall_flags=''
> firewall_logdeny=NO
> firewall_logging=NO
> firewall_myservices=''
> firewall_nat_enable=NO
> firewall_nat_flags=''
> firewall_nat_interface=''
> firewall_nologports='135-139,445 1026,1027 1433,1434'
> firewall_quiet=NO
> firewall_script=/etc/rc.firewall
> firewall_simple_iif=ed1
> firewall_simple_inet=192.0.2.16/28
> firewall_simple_oif=ed0
> firewall_simple_onet=192.0.2.0/28
> firewall_trusted=''
> firewall_type=UNKNOWN
> font8x14=NO
> font8x16=NO
> font8x8=NO
> foo_enable=YES
> forward_sourceroute=NO
> fsck_y_enable=NO
> fsck_y_flags=''
> ftpd_enable=NO
> ftpd_flags=''
> ftpd_program=/usr/libexec/ftpd
> ftpproxy_enable=NO
> ftpproxy_flags=''
> gateway_enable=NO
> gbde_attach_attempts=3
> gbde_autoattach_all=NO
> gbde_devices=NO
> gbde_lockdir=/etc
> geli_autodetach=YES
> geli_default_flags=''
> geli_devices=''
> geli_swap_flags='-e aes -l 256 -s 4096 -d'
> geli_tries=''
> gif_interfaces=''
> gptboot_enable=YES
> gssd_enable=NO
> gssd_flags=''
> harvest_ethernet=YES
> harvest_interrupt=YES
> harvest_p_to_p=YES
> hastd_enable=NO
> hastd_flags=''
> hastd_program=/sbin/hastd
> hcsecd_config=/etc/bluetooth/hcsecd.conf
> hcsecd_enable=NO
> hostapd_enable=NO
> hostid_enable=YES
> hostid_file=/etc/hostid
> hostname=scribe9.vicor.com
> ibcs2_enable=NO
> ibcs2_loaders=coff
> icmp_bmcastecho=NO
> icmp_drop_redirect=NO
> icmp_log_redirect=NO
> ifconfig_em0=DHCP
> ike_enable=NO
> ike_flags=''
> ike_program=/usr/local/sbin/isakmpd
> inetd_enable=NO
> inetd_flags='-wW -C 60'
> inetd_program=/usr/sbin/inetd
> ip6addrctl_enable=YES
> ip6addrctl_policy=AUTO
> ip6addrctl_verbose=NO
> ip_portrange_first=NO
> ip_portrange_last=NO
> ipfilter_enable=NO
> ipfilter_flags=''
> ipfilter_program=/sbin/ipf
> ipfilter_rules=/etc/ipf.rules
> ipfs_enable=NO
> ipfs_flags=''
> ipfs_program=/sbin/ipfs
> ipmon_enable=NO
> ipmon_flags=-Ds
> ipmon_program=/sbin/ipmon
> ipnat_enable=NO
> ipnat_flags=''
> ipnat_program=/sbin/ipnat
> ipnat_rules=/etc/ipnat.rules
> ipsec_enable=NO
> ipsec_file=/etc/ipsec.conf
> ipv6_activate_all_interfaces=NO
> ipv6_cpe_wanif=NO
> ipv6_default_interface=NO
> ipv6_defaultrouter=NO
> ipv6_faith_prefix=NO
> ipv6_gateway_enable=NO
> ipv6_ipfilter_rules=/etc/ipf6.rules
> ipv6_ipv4mapping=NO
> ipv6_network_interfaces=auto
> ipv6_privacy=NO
> ipv6_static_routes=''
> ipxgateway_enable=NO
> ipxrouted_enable=NO
> ipxrouted_flags=''
> jail_enable=NO
> jail_list=''
> jail_parallel_start=NO
> jail_set_hostname_allow=YES
> jail_socket_unixiproute_only=YES
> jail_sysvipc_allow=NO
> kadmind5_server=/usr/libexec/kadmind
> kadmind5_server_enable=NO
> kerberos5_server=/usr/libexec/kdc
> kerberos5_server_enable=NO
> kerberos5_server_flags=--detach
> kern_securelevel=-1
> kern_securelevel_enable=NO
> keybell=NO
> keyboard=''
> keychange=NO
> keymap=NO
> keyrate=fast
> keyserv_enable=NO
> keyserv_flags=''
> kldxref_clobber=NO
> kldxref_enable=NO
> kldxref_module_path=''
> kpasswdd_server=/usr/libexec/kpasswdd
> kpasswdd_server_enable=NO
> ldconfig32_paths=/usr/lib32
> ldconfig_insecure=NO
> ldconfig_local32_dirs=/usr/local/libdata/ldconfig32
> ldconfig_local_dirs=/usr/local/libdata/ldconfig
> ldconfig_paths='/usr/lib/compat /usr/local/lib /usr/local/lib/compat/pkg'
> ldconfig_paths_aout='/usr/lib/compat/aout /usr/local/lib/aout'
> linux_enable=NO
> local_rc=' /usr/local/etc/rc.d/dbus /usr/local/etc/rc.d/git_daemon /usr/local/etc/rc.d/mcwatchdog /usr/local/etc/rc.d/p4d /usr/local/etc/rc.d/rsyncd /usr/local/etc/rc.d/stunnel /usr/local/etc/rc.d/svnserve'
> local_startup=/usr/local/etc/rc.d
> log_in_vain=0
> lpd_enable=NO
> lpd_flags=''
> lpd_program=/usr/sbin/lpd
> mcwatchdog_enable=YES
> mixer_enable=YES
> mountd_enable=YES
> mountd_flags=-r
> mousechar_start=NO
> moused_enable=YES
> moused_flags=''
> moused_nondefault_enable=YES
> moused_port=/dev/psm0
> moused_type=auto
> mroute6d_enable=NO
> mroute6d_flags=''
> mroute6d_program=/usr/local/sbin/pim6dd
> mrouted_enable=NO
> mrouted_flags=''
> mrouted_program=/usr/local/sbin/mrouted
> mta_start_script=/etc/rc.sendmail
> named_auto_forward=NO
> named_auto_forward_only=NO
> named_chroot_autoupdate=YES
> named_chrootdir=/var/named
> named_conf=/etc/namedb/named.conf
> named_enable=NO
> named_program=/usr/sbin/named
> named_symlink_enable=YES
> named_uid=bind
> named_wait=NO
> named_wait_host=localhost
> natd_enable=NO
> natd_flags=''
> natd_interface=''
> natd_program=/sbin/natd
> natm_static_routes=''
> netfs_types='nfs:NFS oldnfs:OLDNFS smbfs:SMB portalfs:PORTAL nwfs:NWFS'
> netwait_enable=YES
> netwait_if_timeout=30
> netwait_timeout=60
> network_interfaces=auto
> newsyslog_enable=YES
> newsyslog_flags=-CN
> nfs_access_cache=60
> nfs_bufpackets=''
> nfs_client_enable=NO
> nfs_reserved_port_only=NO
> nfs_server_enable=YES
> nfs_server_flags='-u -t -n 4'
> nfscbd_enable=NO
> nfscbd_flags=''
> nfsuserd_enable=NO
> nfsuserd_flags=''
> nfsv4_server_enable=NO
> nis_client_enable=NO
> nis_client_flags=''
> nis_server_enable=NO
> nis_server_flags=''
> nis_yppasswdd_enable=NO
> nis_yppasswdd_flags=''
> nis_ypset_enable=NO
> nis_ypset_flags=''
> nis_ypxfrd_enable=NO
> nis_ypxfrd_flags=''
> nisdomainname=NO
> nscd_enable=NO
> ntpd_config=/etc/ntp.conf
> ntpd_enable=NO
> ntpd_flags='-p /var/run/ntpd.pid -f /var/db/ntpd.drift'
> ntpd_program=/usr/sbin/ntpd
> ntpd_sync_on_start=NO
> ntpdate_config=/etc/ntp.conf
> ntpdate_enable=YES
> ntpdate_flags=-b
> ntpdate_hosts=time-nw.nist.gov
> ntpdate_program=/usr/sbin/ntpdate
> oldnfs_server_enable=NO
> opensm_enable=NO
> performance_cpu_freq=NONE
> performance_cx_lowest=HIGH
> pf_enable=NO
> pf_flags=''
> pf_program=/sbin/pfctl
> pf_rules=/etc/pf.conf
> pflog_enable=NO
> pflog_flags=''
> pflog_logfile=/var/log/pflog
> pflog_program=/sbin/pflogd
> pfsync_enable=NO
> pfsync_ifconfig=''
> pfsync_syncdev=''
> pfsync_syncpeer=''
> populate_var=AUTO
> powerd_enable=NO
> powerd_flags=''
> ppp_enable=NO
> ppp_mode=auto
> ppp_nat=YES
> ppp_profile=papchap
> ppp_program=/usr/sbin/ppp
> ppp_user=root
> pppoed_enable=NO
> pppoed_flags='-P /var/run/pppoed.pid'
> pppoed_interface=fxp0
> pppoed_provider='*'
> quota_enable=NO
> quotacheck_flags=-a
> quotaoff_flags=-a
> quotaon_flags=-a
> rarpd_enable=NO
> rarpd_flags=-a
> rc_conf_files='/etc/rc.conf /etc/rc.conf.local'
> rc_debug=NO
> rc_fast=yes
> rc_info=NO
> rc_startmsgs=YES
> rcshutdown_timeout=90
> rfcomm_pppd_server_enable=NO
> rfcomm_pppd_server_one_channel=1
> rfcomm_pppd_server_profile='one two'
> rfcomm_pppd_server_two_channel=3
> root_rw_mount=YES
> route6d_enable=NO
> route6d_flags=''
> route6d_program=/usr/sbin/route6d
> routed_enable=NO
> routed_flags=-q
> routed_program=/sbin/routed
> rpc_lockd_enable=YES
> rpc_lockd_flags=''
> rpc_statd_enable=YES
> rpc_statd_flags=''
> rpc_ypupdated_enable=NO
> rpcbind_enable=NO
> rpcbind_flags=''
> rpcbind_program=/usr/sbin/rpcbind
> rtadvd_enable=NO
> rtadvd_interfaces=''
> rtsol_flags=''
> rtsold_enable=NO
> rtsold_flags=-a
> rwhod_enable=NO
> rwhod_flags=''
> savecore_flags=''
> saver=beastie
> script_name_sep=' '
> scrnmap=NO
> sdpd_control=/var/run/sdp
> sdpd_enable=NO
> sdpd_groupname=nobody
> sdpd_username=nobody
> sendmail_enable=NO
> sendmail_flags='-L sm-mta -bd -q30m'
> sendmail_msp_queue_enable=YES
> sendmail_msp_queue_flags='-L sm-msp-queue -Ac -q30m'
> sendmail_outbound_enable=YES
> sendmail_outbound_flags='-L sm-queue -q30m'
> sendmail_pidfile=/var/run/sendmail.pid
> sendmail_procname=/usr/sbin/sendmail
> sendmail_rebuild_aliases=NO
> sendmail_submit_enable=YES
> sendmail_submit_flags='-L sm-mta -bd -q30m -ODaemonPortOptions=Addr=localhost'
> skip='-s nostart'
> source_rc_confs_defined=yes
> sppp_interfaces=''
> sshd_enable=YES
> sshd_flags='-g 300'
> sshd_program=/usr/sbin/sshd
> static_arp_pairs=''
> static_ndp_pairs=''
> static_routes=''
> stf_interface_ipv4addr=''
> stf_interface_ipv4plen=0
> stf_interface_ipv6_ifid=0:0:0:1
> stf_interface_ipv6_slaid=0000
> svr4_enable=NO
> swapfile=NO
> synchronous_dhclient=NO
> syslogd_enable=YES
> syslogd_flags=-s
> syslogd_program=/usr/sbin/syslogd
> sysvipc_enable=NO
> tcp_drop_synfin=NO
> tcp_extensions=YES
> tcp_keepalive=YES
> timed_enable=NO
> timed_flags=''
> tmpmfs=AUTO
> tmpmfs_flags=-S
> tmpsize=20m
> ubthidhci_enable=NO
> ugidfw_enable=NO
> update_motd=YES
> varmfs=AUTO
> varmfs_flags=-S
> varsize=32m
> virecover_enable=YES
> watchdogd_enable=NO
> watchdogd_flags=''
> weak_mountd_authentication=NO
> wpa_supplicant_conf_file=/etc/wpa_supplicant.conf
> wpa_supplicant_flags=-s
> wpa_supplicant_program=/usr/sbin/wpa_supplicant
> zfs_enable=YES
>
> Compare that with the following:
>
> dteske@scribe9.vicor.com ~ $ sr service foo start
> dteske@scribe9.vicor.com ~ $ cat /tmp/termtest
> HOME=/
> IFS='
> '
> OPTIND=1
> PATH=/sbin:/bin:/usr/sbin:/usr/bin
> PPID=1285
> PS1='# '
> PS2='> '
> PS4='+ '
> PWD=/
>
> Looks to me like some things are being inherited.
> Notably, it would appear that the rc.d scripts are
> run within the parent namespace which has had
> source_rc_confs() called (I'm leaving alone for the
> moment that this indicates that each rc-script is
> being less than efficient by re-sourcing rc.subr).
>
> Given the above (that we are farther from a "clean
> environment" than one might expect), is it really
> that big of a deal to expose $TERM? If so, what are
> the serious issues that could arise?
>
> I personally cannot think of any shortcomings or
> fallout from adding $TERM to be exposed.
>

You said the shortcoming yourself - it doesn't fix the issue at boot. 
What exactly are you fixing? What screen/tmux rc scripts are you 
referring to? The ports don't have these.

Also your change introduces bugs into the manpage which states exactly 
what environment is passed in.

What terminal I happen to restart a script from should not affect the 
process. This is a regression of one of the key *documented* points of 
service(8) that it will not pollute the rc script with the calling 
environment. TERM is a pretty big aspect of an environment.

I run my systems 100% remotely. I don't want whatever console happens to 
be setup to be modifying my startup scripts with a TERM value. 
Especially if I go run service(8) from SSH and have it change behavior 
further.

-- 
Regards,
Bryan Drewery



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53C5F501.1050304>