From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12850 invoked by alias); 12 Jan 2015 00:26:46 -0000 Mailing-List: contact cygwin-xfree-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-xfree-owner@cygwin.com Reply-To: cygwin-xfree@cygwin.com Mail-Followup-To: cygwin-xfree@cygwin.com Received: (qmail 12833 invoked by uid 89); 12 Jan 2015 00:26:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.0 required=5.0 tests=AWL,BAYES_50,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: Ishtar.hs.tlinx.org Received: from ishtar.tlinx.org (HELO Ishtar.hs.tlinx.org) (173.164.175.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 12 Jan 2015 00:26:42 +0000 Received: from [192.168.4.12] (Athenae [192.168.4.12]) by Ishtar.hs.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id t0C0QVE9039362 for ; Sun, 11 Jan 2015 16:26:34 -0800 Message-ID: <54B314B7.5010008@tlinx.org> Date: Mon, 12 Jan 2015 00:26:00 -0000 From: Linda Walsh User-Agent: Thunderbird MIME-Version: 1.0 To: cygwin-xfree@cygwin.com Subject: solution for package startup scripts changing: do your own (was Re: run.exe will not work with upgrade from 1.14.4 to 1.16.3) References: <54A6FDB8.9070106@blankersfamily.com> In-Reply-To: <54A6FDB8.9070106@blankersfamily.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg00025.txt.bz2 Laurens Blankers wrote: > On 2-1-2015 21:10, schilpfamily wrote: >> this has worked for years, now when i run this command, a window very >> briefly blinks into existence but then goes away. any idea why this >> would stop working now? ==== Because the default options in the distribution provided startup script changed to a more secure setting, consistent with upstream changes and the general atmosphere of security paranoia that is gradually eroding usability (as security issues get alot more attention than usability -- so much so, that while a benefit of computers was that they could adapt to the user for a friendly user experience, the opposite is becoming the standard. I.e. users are expected to adapt themselves to the changing machine programs. I start my X server on login -- which means it has to work when called at login -- and I wanted to make sure I could pass custom arguments for the font path (among other things). As a result I simply "wrote my own" startup script that has it's own defaults. I expect it to work until some argument I expect to be there is deleted. I don't instantly get new features and benefits that might be invoked from the distribution script, but usually it starts, and every once in a while I review it and the cygwin start scripts to see if there is something I should change. But at least I don't get caught by this particular problem. I *do* still get caught by the installer overwriting Windows mount points with physical directories which causes various programs to stop functioning until I move the updated files to the 'mount-point' and change the physdir back to a mount point. Anyway, --- The script is started by a shortcut in: C:\Users\\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup That has a shortcut to 'bash' with arguments: (Target:) C:\bin\bash.exe -c '/bin/setsid "%USERPROFILE%/bin/startxwin.sh"' (Start in:) %HOMEDRIVE%%HOMEPATH% (Run:) Minimized ---- It is also an icon on my 'Quick Launch' bar (i.e. in directory): C:\Users\\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch ---startxwin.sh--- #!/bin/bash # (c) LA Walsh 2004-2014, licenced under GPLv2 #export DISPLAY=:0 #export XAPPLRESDIR=/usr/X11R6/lib/X11/app-defaults #export XCMSDB=/usr/X11R6/lib/X11/Xcms.txt #export XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB #export XNLSPATH=/usr/X11R6/lib/X11/locale #unexport XAPPLRESDIR XCMSDB XKEYSYMDB XNLSPATH # see cygwin Xwin for more option examples # relevant ops: # -multiwindow = use windows manage; not w/(-rootless|-fullscreen) # -clipboard = use built-in version (integrated w/windows) # -unixkill = Enable Ctrl-Alt-BS as X-server shutdown cmnd # -nowinkill = Disable Alt+F4 as a server shutdown key combination. # -trayicon = (default) windows tray icon enabled mount -c / export PATH=/bin:$(/bin/cygpath "$USERPROFILE")/bin:$PATH #ensure our bin is 1st shopt -s expand_aliases extglob alias notify=$(type -P notifu) alias int=declare\ -i alias sub=function alias xset=$(type -P xset); alias array=declare\ -a alias my=declare export DISPLAY="${DISPLAY:-":0"}" sub xup { local stat read -t .1 stat <<<$(xset q >&/dev/null; echo $?) && return $stat ((-1)) } sub Xwin_pids { ( cd /proc && for p in +([0-9])/ ;do p2=${p%/} prg=$(<${p2}/exename) if [[ $prg =~ .*XWin ]]; then printf "%d:%s\n" "$p2" "$prg" fi done ) } sub Xwin_pid { array Xprgs readarray Xprgs< <(Xwin_pids) if ((!${#Xprgs[@]}));then echo 0 return 1 fi my x=${Xprgs[0]} my pid=${x%%:**} prg=${x##*:} array out=( "$pid" "$prg") printf "%s " "${out[@]}" printf "\n" return 0 } sub Xwin_running { int pd; my pg read pd pg < <(Xwin_pid) return $(((!pd))) } export -f Xwin_pids Xwin_pid sub tidy_old_Xwin { local -a sigs=(TERM TERM KILL) # try 2 TERMs then KILL upto maxsigs int pd; my pg int maxsigs=3 lastsig=${#sigs[*]} while ((1)); do read pd pg < <(Xwin_pid) ((pd)) || break #int i=--maxsigs>lastsig ? lastsig:maxsigs kill -${sigs[--maxsigs>lastsig ? lastsig:maxsigs]} $pd ((maxsigs)) || break sleep 1 done rm -fr /tmp/.X11-unix } sub get_dpi { dpi=$(regtool -d get '/HKLM/Software/Microsoft/Windows NT/CurrentVersion/FontDPI/LogPixels') # check for insane values ((dpi<50||dpi>>400)) && dpi=96 echo "$dpi" } sub get_fontpath { local fontpath="/usr/share/TTF:tcp/ishtar:7100,built-ins,/usr/share/fonts/Type1,/usr/share/fonts/misc,/usr/share/fonts/100dpi" echo -n "$fontpath" } sub start_XWin { local fontpath="/usr/share/fonts/TTF,built-ins,/usr/share/fonts/Type1,/usr/share/fonts/misc,/usr/share/fonts/100dpi" int dpi=$(get_dpi) cmd="/bin/run /bin/XWin ${dpi:+-dpi $dpi} -nomultimonitors -clipboard -ac -unixkill -nowinkill -wgl -bs -fp "$fontpath" -multiwindow" echo cmd="$cmd" $cmd } declare -a default_switches=(-dpi -clipboard -unixkill -nowinkill -bs -ac -fp -multiwindow -wgl) readarray -t args< <( a="$default_switches[@]"; IFS=$'\n'; echo "${a[*]#?}"|sort -k1.2 ) sub read_users_mind { #(reads file in lieu of HW support for actual) if [[ -O ~/.mind && -O ~/.mind/Xserver-dflt-overrides ]]; then readarray -t overrides < <( -x <~/.mind/Xserver-dflt-overrides perl -wnE ' chomp; s/\s*(?:#.*)?$//; s/^\s*// s/\s\s+/\s/ ; $_ || next; print $_."\n" ') fi typeset -a switches } sub start_dbus { /bin/run /bin/dbus-launch --exit_with_session ~/.Xsession } sub _in { local x=${1:?};shift for ((;$#>0;)); do [[ $x == $1 ]] && return 0;shift; done return 1 } int tries=3 if Xwin_running && xup; then notify /t info /m "Xserver already running and ready" /d 5000 else echo Cannot contact X Server tidy_old_Xwin while ((1)); do start_XWin $(read_users_mind) sleep 1 for ((i=0;i<5;++i)); do xup && break 2 sleep 1 done if ((--tries<=0)); then m="EXITING: Timeout Waiting for Xserver Startup!!" echo "$m" notify /t error /m "$m" exit 1; fi done #start_dbus || { m="Error Starting Dbus"; echo "$m"; notify /t error /m "$m"; } fi # vim: ts=2:sw=2 -------------- > This is most likely due to a major rewrite of the xinit package which > contains all start-up scripts. ---- Not if you write your own -- then you will get your own "customized" behavior (so at least when it breaks, you have a chance to fix it yourself)... If you don't like mine, fine, copy the cygwin script and make the changes to it and call it the same way. At least you'll get whatever behavior you want and upgrades won't be altering your script... BTW, Laurens Blankers, the opensource model for developers doing their own thing is called a "do-acracy". Those that do, make the rules. Not saying it is a great thing, just putting a handle on it... ;-) -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://x.cygwin.com/docs/ FAQ: http://x.cygwin.com/docs/faq/