All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dominick Grift <dac.override@gmail.com>
To: selinux@tycho.nsa.gov
Subject: Re: [PATCH 1/6] Revert "policycoreutils: let output of `fixfiles` be redirected (as normal)"
Date: Thu, 4 May 2017 19:28:19 +0200	[thread overview]
Message-ID: <20170504172819.GB29905@julius> (raw)
In-Reply-To: <20170504170122.26882-1-alan.christopher.jenkins@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1939 bytes --]

On Thu, May 04, 2017 at 06:01:17PM +0100, Alan Jenkins wrote:
> This reverts commit ac7899fc3ad6221e195dd13cdf14b346897314ae,
> which is not yet part of an officially tagged release
> (or release candidate).
> 
> `LOGFILE=/proc/self/fd/1` was wrong.
> 
> `LOGFILE=$(tty)` was being relied on in one case (exclude_dirs),
> to log messages from a function run specifically with stdout redirected
> (captured into a variable).
> 
> Having `logit "message"` break inside redirected functions
> is a nasty leaky abstraction.
> 
> This caused e.g. `fixfiles restore` to terminate early with the error
> 
>     skipping: No such file or directory
> 
> if the user had configured any excluded paths in
> /etc/selinux/fixfiles_exclude_dirs
> ---
>  policycoreutils/scripts/fixfiles | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/policycoreutils/scripts/fixfiles b/policycoreutils/scripts/fixfiles
> index bc74d69..75d7762 100755
> --- a/policycoreutils/scripts/fixfiles
> +++ b/policycoreutils/scripts/fixfiles
> @@ -119,7 +119,11 @@ VERBOSE="-p"
>  FORCEFLAG=""
>  DIRS=""
>  RPMILES=""
> -LOGFILE=/proc/self/fd/1
> +LOGFILE=`tty`
> +if [ $? != 0 ]; then
> +    LOGFILE="/dev/null"
> +fi
> +LOGGER=/usr/sbin/logger

$ ls /usr/bin/logger
/usr/bin/logger
$ ls /usr/sbin/logger
ls: cannot access '/usr/sbin/logger': No such file or directory

>  SETFILES=/sbin/setfiles
>  RESTORECON=/sbin/restorecon
>  FILESYSTEMSRW=`get_rw_labeled_mounts`
> @@ -134,11 +138,11 @@ else
>  fi
>  
>  #
> -# Write to LOGFILE
> +# Log to either syslog or a LOGFILE
>  #
>  logit () {
>  if [ -n $LOGFILE ]; then
> -    echo $1 >> "$LOGFILE"
> +    echo $1 >> $LOGFILE
>  fi
>  }
>  #
> -- 
> 2.9.3
> 

-- 
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8  02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  parent reply	other threads:[~2017-05-04 17:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-04 17:01 [PATCH 1/6] Revert "policycoreutils: let output of `fixfiles` be redirected (as normal)" Alan Jenkins
2017-05-04 17:01 ` [PATCH 2/6] policycoreutils: fixfiles: remove (broken) redundant code Alan Jenkins
2017-05-04 17:01 ` [PATCH 3/6] policycoreutils: fixfiles: clarify exclude_dirs() Alan Jenkins
2017-05-04 17:01 ` [PATCH 4/6] policycoreutils: fixfiles: fix logging about R/O filesystems Alan Jenkins
2017-05-04 17:01 ` [PATCH 5/6] policycoreutils: fixfiles: move logit call outside of redirected function Alan Jenkins
2017-05-04 17:01 ` [PATCH 6/6] policycoreutils: fixfiles: deprecate -l option Alan Jenkins
2017-05-04 17:28 ` Dominick Grift [this message]
2017-05-04 17:32   ` [PATCH 1/6] Revert "policycoreutils: let output of `fixfiles` be redirected (as normal)" Dominick Grift
2017-05-05 17:31 ` James Carter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170504172819.GB29905@julius \
    --to=dac.override@gmail.com \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.