delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/04/10/16:29:50

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:subject:to:message-id:date:mime-version
:content-type:content-transfer-encoding; q=dns; s=default; b=LgB
R7/FbEUtD6jIRJy3kKZzwcfctl75SoV/YWRAxBIYLWydROqyHC+vXl9RJDx41wcM
cTWLeeg1NhSACuV55/pnPnMhXqHFXASvJzn9MblsSt1QVR0rpbPo6/IuaitzMUSt
zSmSKuDlv30qsOrrMSd001kOwfHvFKGYChfmVA/A=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:subject:to:message-id:date:mime-version
:content-type:content-transfer-encoding; s=default; bh=VAWqcU9pb
Wllw9VX3uD847orI3I=; b=cCsj7E/YaSJUQ/dpIYD/k3WVa+JU/wx91qlMh1nHo
XFgimHpEYLHLVcG6LcSFVcuQNwjXdc1uanZUH8MBVX4nV9WKOJLUOQpKsOutAUeI
yLBVcqZEvj/erqnjwmmJfRvCGlOoc5ZZJuGcuEx/jGeiLGBD8a6Oy21P5+jYcwxY
ho=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=H*MI:online, UD:lv, techo, Net
X-HELO: mailout02.t-online.de
From: Christian Franke <Christian DOT Franke AT t-online DOT de>
Subject: Use a default path in exec*p*() if PATH is unset?
To: cygwin AT cygwin DOT com
Message-ID: <d1bc1cea-2438-5e03-e84c-8d4e169d9592@t-online.de>
Date: Mon, 10 Apr 2017 22:29:19 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49
MIME-Version: 1.0
X-IsSubscribed: yes

A few years after https://cygwin.com/ml/cygwin/2014-09/msg00204.html
I found another use case of an unset PATH variable:

The configure script from mandoc (http://mdocml.bsd.lv/) uses this 
interesting approach to query default CC command from make:

CC=`printf "all:\\n\\t AT echo \\\$(CC)\\n" | env -i make -sf -`

This works at least on Linux, (Free|Net|Open)BSD and OpenIndiana. It 
fails on Cygwin because 'env -i' unsets everything and execvp() does not 
use a default path then. This is OK from the POSIX 
("implementation-defined") point of view but differs from existing practice.

At least some Linux distros use ".:/bin:/usr/bin" as default path 
(https://linux.die.net/man/3/exec). Including the current directory is 
IMO a bad idea.

This is apparently inherited from the early days:
The current directory is included on current Debian stable, and
[... time travel ...]
also
[... time travel ...]
on Slackware 1.0.1 from 1993 :-)
(Thanks to http://www.qemu-advent-calendar.org/2014/ for this image)

Other OS typically use a default path without current directory.

Should Cygwin also use a default path, for example _PATH_DEFPATH=/bin ?

Christian


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019