From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12976 invoked by alias); 14 Oct 2015 17:14:08 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 12958 invoked by uid 89); 14 Oct 2015 17:14:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f179.google.com Received: from mail-wi0-f179.google.com (HELO mail-wi0-f179.google.com) (209.85.212.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 14 Oct 2015 17:14:06 +0000 Received: by wieq12 with SMTP id q12so93196406wie.1 for ; Wed, 14 Oct 2015 10:14:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=X2HduIDJrUackVlNGRAt6BX0T17VIeoUmTwaXjQpAeQ=; b=m/meFn+Q430GeEhr0nS32qIFPDgF6U8WsNiaRFBIZtQJw/se4lDsf1NcaPhcmmS9pq +AQ3rsnBwIfo7y0JOLvvSKvPBnR3Uya19S95y5XO8CwNEPeEuo+4+Me4hIAFQ/v8zB4u LuqVtDqUpcQe2X2XK0mcaeBk12Dev7jn5OqcMMWDE//ApsItKDDfiOTW2XgN6H3E/V3J MNY3YCLorz6ZDZyuLoaoDjbWsFnR7dLB39g0vMlxo/zaLsxQBfqeQW9Qc1ZhSSD7rAna yUj/TdDH9n9bzc2hT88qXnWxUjOTqR9WdFRDGfGzFoQ6ECbtwwhRAIJsZMuj9ErJleON GnWw== X-Gm-Message-State: ALoCoQlTKQjxnsOCrRXgG3Zq76WSoysypEci0VRdq6E5SdgWCmSaeCYKADfolw6cKvw35W5SqHoA X-Received: by 10.194.58.177 with SMTP id s17mr6267748wjq.102.1444842843428; Wed, 14 Oct 2015 10:14:03 -0700 (PDT) Received: from dinwoodie.org ([2001:ba8:0:1c0::9:1]) by smtp.gmail.com with ESMTPSA id z4sm6705988wjz.29.2015.10.14.10.14.02 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 14 Oct 2015 10:14:02 -0700 (PDT) Date: Wed, 14 Oct 2015 17:14:00 -0000 From: Adam Dinwoodie To: cygwin@cygwin.com Subject: Re: [Attn: base-files maintainer] Changing /etc/profile to add more shell-dependent settings Message-ID: <20151014171400.GP14466@dinwoodie.org> Reply-To: cygwin@cygwin.com References: <20151014155256.GN14466@dinwoodie.org> <876129s86w.fsf@Rainer.invalid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <876129s86w.fsf@Rainer.invalid> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg00167.txt.bz2 On Wed, Oct 14, 2015 at 06:53:27PM +0200, Achim Gratz wrote: > Adam Dinwoodie writes: > > The /etc/defaults/etc/profile file in base-files has a section at the > > end to import scripts in /etc/profile.d, but this currently only works > > with zsh. > > No, this section is specific to zsh and probably even the wrong thing to > do -- /etc/profile is only ever intended to be run by POSIX compatible > shells (or shells in POSIX mode if they support that notion). I've kept > it alive for the time being since nothing packaged in Cygwin depends on > it. For anybody else using it for their personal customization it must > already be working. > > > Can this section be expanded to make calls as appropriate for other > > shells? I'm particularly interested in Fish and Bash, although I don't > > see any reason to limit the change to those shells. > > Bash can use ".sh" with the proviso that you can only use the POSIX > subset of its functionality. Other, non-POSIX, shells should implement > something similar in their own startup scripts. Csh already does, I > don't know enough about fish to tell how to insert something into its > start-up. IIRC, Zsh also has a way to run extra code besides just the > one in /etc/profile if you somehow need that. > > > I care about this because I'm currently investigating packaging fzf[0]. > > The obvious way to include the shell-specific keyboard shortcuts for fzf > > is to add them to /etc/profile.d, but currently that only works for > > Z-Shell. > > Look again, and don't let yourself get distracted by the zsh specific > code. :-) Mmmkay. So I'll find somewhere else to put the zsh and fish specific scripts (I've already found somewhere for fish, and I'll take your word that zsh also has a similar directory). That, however, doesn't give me anywhere to put the Bash fzf script. It's not POSIX compliant, so I don't want to use ".sh". I can't find any directory other than /etc/profile.d that Bash trawls, though. The only other option I can think of is to rename the .bash file to .sh and to patch it to check $BASH_VERSION before running the Bash-specific code. That seems fragile though -- it means putting Bashisms in a script that may be run by non-Bash shells (even if it's gated by checking $BASH_VERSION), and it means a patch of the upstream fzf Bash script in a way that's essentially just duplicating code already in /etc/profile. (The upstream solution to this is to add code to the user's ~/.bashrc to source the relevant scripts, but I don't think that's feasible when installing the scripts via setup-*.exe.) -- 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