Re: 'tty' output on kFreeBSD, etc. within sbuild
Alastair McKinstry writes ('tty' output on kFreeBSD, etc. within sbuild): Can anyone answer the following question which is puzzling me; I have a piece of csh code which gets called during the build of a package i'm maintaining. it does the following: echo useful information /dev/tty within the script. (stdout, stderr being redirected, I think). Others have explained why you shouldn't do this. If you want to bypass some redirection in the rest of your package's build system, you could stash a copy of stderr in fd 3 or 5 or something (eg, in the rules file, with 32), and then write to fd 5. But perhaps more information would enable us to give better advice. Thanks, Ian. -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/21194.41999.179696.729...@chiark.greenend.org.uk
Re: 'tty' output on kFreeBSD, etc. within sbuild
On 06/01/2014 12:39, Ian Jackson wrote: Alastair McKinstry writes ('tty' output on kFreeBSD, etc. within sbuild): Can anyone answer the following question which is puzzling me; I have a piece of csh code which gets called during the build of a package i'm maintaining. it does the following: echo useful information /dev/tty within the script. (stdout, stderr being redirected, I think). Others have explained why you shouldn't do this. If you want to bypass some redirection in the rest of your package's build system, you could stash a copy of stderr in fd 3 or 5 or something (eg, in the rules file, with 32), and then write to fd 5. But perhaps more information would enable us to give better advice. Thanks, Ian. Thanks, I've been able to adapt the build scripts so it is not necessary; they just output to stdout. Regards Alastair -- Alastair McKinstry , alast...@sceal.ie , mckins...@debian.org http://blog.sceal.ie Anyone who believes exponential growth can go on forever in a finite world is either a madman or an economist - Kenneth Boulter, Economist. -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/52cab929.9050...@sceal.ie
Re: 'tty' output on kFreeBSD, etc. within sbuild
Alastair McKinstry writes (Re: 'tty' output on kFreeBSD, etc. within sbuild): On 06/01/2014 12:39, Ian Jackson wrote: But perhaps more information would enable us to give better advice. Thanks, I've been able to adapt the build scripts so it is not necessary; they just output to stdout. Great, thanks. Ian. -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/21194.51175.579425.166...@chiark.greenend.org.uk
'tty' output on kFreeBSD, etc. within sbuild
Hi, Can anyone answer the following question which is puzzling me; I have a piece of csh code which gets called during the build of a package i'm maintaining. it does the following: echo useful information /dev/tty within the script. (stdout, stderr being redirected, I think). This fails on kFreeBSD at least, so i've patched it to: set ttyf=`tty` ... echo useful information $ttyf This works on Linux, and on the command line for me on a kFreeBSD machine, but under sbuild I get: $ttyf: Ambiguous. Unable to build Makefile - fix above errors and re-run. Any ideas as to whats happening and what I should do about it? Regards Alastair -- Alastair McKinstry , alast...@sceal.ie , mckins...@debian.org http://diaspora.sceal.ie/u/amckinstry Anyone who believes exponential growth can go on forever in a finite world is either a madman or an economist - Kenneth Boulter, Economist.
Re: 'tty' output on kFreeBSD, etc. within sbuild
On Fri, Jan 03, 2014 at 06:51:08PM +, Alastair McKinstry wrote: Can anyone answer the following question which is puzzling me; I have a piece of csh code which gets called during the build of a package i'm maintaining. it does the following: echo useful information /dev/tty within the script. (stdout, stderr being redirected, I think). This fails on kFreeBSD at least, so i've patched it to: set ttyf=`tty` ... echo useful information $ttyf This works on Linux, and on the command line for me on a kFreeBSD machine, but under sbuild I get: $ttyf: Ambiguous. Unable to build Makefile - fix above errors and re-run. Any ideas as to whats happening and what I should do about it? You aren't guaranteed to have a controlling terminal, particularly when run via buildd. So while stdin/out/err are all connected and functional, they are either null (stdin) or pipes (out/err). If you need to output anything, then just use stdout/err as appropriate and it will be logged, but /dev/tty may well be unavailable. I would recommend not using `tty` or doing any IO on /dev/tty since in all likelihood isatty/ttyname(_r) will most likely return ENOTTY and any IO on /dev/tty will simply fail. We have looked at using ptys in the past for running the builds in order to guarantee a tty, but decided against it. Too many programs make the assumption that they are interactive and freeze the build waiting on IO that never happens and then block forever. There may well have been other considerations I don't recall offhand e.g. relating to job control. Regards, Roger -- .''`. Roger Leigh : :' : Debian GNU/Linux http://people.debian.org/~rleigh/ `. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/ `-GPG Public Key: 0x25BFB848 Please GPG sign your mail. signature.asc Description: Digital signature
Re: 'tty' output on kFreeBSD, etc. within sbuild
On Fri, Jan 03, 2014 at 07:12:51PM +, Roger Leigh wrote: You aren't guaranteed to have a controlling terminal, particularly when run via buildd. So while stdin/out/err are all connected and functional, they are either null (stdin) or pipes (out/err). If you need to output anything, then just use stdout/err as appropriate and it will be logged, but /dev/tty may well be unavailable. I would recommend not using `tty` or doing any IO on /dev/tty since in all likelihood isatty/ttyname(_r) will most likely return ENOTTY and any IO on /dev/tty will simply fail. We have looked at using ptys in the past for running the builds in order to guarantee a tty, but decided against it. Too many programs make the assumption that they are interactive and freeze the build waiting on IO that never happens and then block forever. There may well have been other considerations I don't recall offhand e.g. relating to job control. There are some limited situations (e.g. test suites) where it can come in handy. For these, I'd recommend lifting the debian/script.py I wrote from the python2.7 source package, which gives you a pty in a way that's known to work well within builds and writes output to a file. -- Colin Watson [cjwat...@debian.org] -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20140103202904.ga29...@riva.ucam.org