Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Ismael Luceno (80d53a2f46b2f848598059d22f12cde44be3c2d2)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Ismael Luceno <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Ismael Luceno (80d53a2f46b2f848598059d22f12cde44be3c2d2)
  • Date: Sat, 14 Oct 2023 15:01:22 +0000

GIT changes to master sorcery by Ismael Luceno <ismael AT sourcemage.org>:

usr/sbin/alter | 10 ++--
usr/sbin/delve | 82
++++++++++++++++-----------------
var/lib/sorcery/modules/build_api/api1 | 17 ++++--
var/lib/sorcery/modules/build_api/api2 | 24 ++++++---
var/lib/sorcery/modules/libmisc | 17 ------
5 files changed, 76 insertions(+), 74 deletions(-)

New commits:
commit 80d53a2f46b2f848598059d22f12cde44be3c2d2
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

Revert "Implement logging by reusing file descriptors"

This reverts commit e9a142540638bf09792acc31fd8d715e3b59d962.

diff --git a/usr/sbin/alter b/usr/sbin/alter
index 2c52815..f15f1ba 100755
--- a/usr/sbin/alter
+++ b/usr/sbin/alter
@@ -43,17 +43,19 @@ EOF
[ -n "$COM_DATA" ] && echo "$COM_DATA" > "$C_LOG"
message "${MESSAGE_COLOR}Altering...${DEFAULT_COLOR}"

- reserve_fds VOYEUR_STDOUT VOYEUR_STDERR
if [ "$VOYEUR" == "on" -a -z "$SILENT" ]; then
- eval "exec $((VOYEUR_STDOUT))>&1 $((VOYEUR_STDERR))>&2"
+ VOYEUR_STDOUT=/dev/stdout
+ VOYEUR_STDERR=/dev/stderr
+ else
+ VOYEUR_STDOUT=/dev/null
+ VOYEUR_STDERR=/dev/null
fi

invoke_installwatch
(
echo "$@"
echo "$@" | bash
- ) 2> >(tee -a "$C_LOG" >& "$VOYEUR_STDERR") \
- > >(tee -a "$C_LOG" >& "$VOYEUR_STDOUT")
+ ) 2> >(tee -a $C_LOG 1>&2 > $VOYEUR_STDERR) > >(tee -a $C_LOG >
$VOYEUR_STDOUT)
devoke_installwatch
touch $IW_LOG $MD5_LOG $C_LOG_COMP
create_install_log $IW_LOG $INST_LOG
diff --git a/usr/sbin/delve b/usr/sbin/delve
index 5eb6b73..1c1360a 100755
--- a/usr/sbin/delve
+++ b/usr/sbin/delve
@@ -102,16 +102,11 @@ delve_log_helper() {
CASTFS_DBGLOG=${CASTFS_DBGLOG:="/tmp/sorcery/delve/$SPELL.iwdbglog"}
C_FIFO=${C_FIFO:="/dev/stdout"}
IW_LOG=${IW_LOG:="/tmp/sorcery/delve/$SPELL.iw"}
+ VOYEUR_STDOUT=${VOYEUR_STDOUT:="/dev/stdout"}
+ VOYEUR_STDERR=${VOYEUR_STDERR:="/dev/stderr"}
S_PWD=${S_PWD:="/tmp/sorcery/delve/$SPELL.pwd"}
touch $C_LOG
- if [ -z "$VOYEUR_STDOUT" ]; then
- reserve_fds VOYEUR_STDOUT
- eval "exec $((VOYEUR_STDOUT))>&1"
- fi
- if [ -z "$VOYEUR_STDERR" ]; then
- reserve_fds VOYEUR_STDERR
- eval "exec $((VOYEUR_STDERR))>&2"
- fi
+
}

#---------------------------------------------------------------------------
@@ -156,20 +151,22 @@ delve_build() {
debug "delve" "Running $FUNCNAME"
delve_is_valid_step BUILD 1 2 || return 1
delve_log_helper
- ( run_build ) \
- 3> >(tee -a "$C_LOG") \
- 2> >(tee -a "$C_LOG" >& "$VOYEUR_STDERR") \
- > >(tee -a "$C_LOG" >& "$VOYEUR_STDOUT")
+ (
+ run_build
+ ) 3> >(tee -a $C_LOG >> /dev/stdout) \
+ 2> >(tee -a $C_LOG 1>&2 > $VOYEUR_STDERR) \
+ > >(tee -a $C_LOG > $VOYEUR_STDOUT)
}

delve_pre_install() {
debug "delve" "Running $FUNCNAME"
delve_is_valid_step PRE_INSTALL 2 || return 1
delve_log_helper
- ( run_pre_install ) \
- 3> >(tee -a "$C_LOG") \
- 2> >(tee -a "$C_LOG" >& "$VOYEUR_STDERR") \
- > >(tee -a "$C_LOG" >& "$VOYEUR_STDOUT")
+ (
+ run_pre_install
+ ) 3> >(tee -a $C_LOG >> /dev/stdout) \
+ 2> >(tee -a $C_LOG 1>&2 > $VOYEUR_STDERR) \
+ > >(tee -a $C_LOG > $VOYEUR_STDOUT)
}

delve_staged_install_setup() {
@@ -200,11 +197,11 @@ delve_install() {
else
$CHROOT_CMD delve $SPELL INSTALL
fi
- ) 3> >(tee -a "$C_LOG") \
- 2> >(tee -a "$C_LOG" >& "$VOYEUR_STDERR") \
- > >(tee -a "$C_LOG" >& "$VOYEUR_STDOUT")
+ ) 3> >(tee -a $C_LOG >> /dev/stdout) \
+ 2> >(tee -a $C_LOG 1>&2 > $VOYEUR_STDERR) \
+ > >(tee -a $C_LOG > $VOYEUR_STDOUT)
local rc=$?
- if [[ -n "$CHROOT_CMD" && "$STAGED_INSTALL" = castfs ]]
+ if [[ $CHROOT_CMD ]]
then
devoke_stage_root
fi &&
@@ -224,11 +221,11 @@ delve_install_extras() {
else
$CHROOT_CMD delve $SPELL INSTALL_EXTRAS
fi
- ) 3> >(tee -a "$C_LOG") \
- 2> >(tee -a "$C_LOG" >& "$VOYEUR_STDERR") \
- > >(tee -a "$C_LOG" >& "$VOYEUR_STDOUT")
+ ) 3> >(tee -a $C_LOG >> /dev/stdout) \
+ 2> >(tee -a $C_LOG 1>&2 > $VOYEUR_STDERR) \
+ > >(tee -a $C_LOG > $VOYEUR_STDOUT)
local rc=$?
- if [[ -n "$CHROOT_CMD" && "$STAGED_INSTALL" = castfs ]]
+ if [[ $CHROOT_CMD ]]
then
devoke_stage_root
fi &&
@@ -245,30 +242,33 @@ delve_post_build() {
return 1
}
cd $SOURCE_DIRECTORY
- ( run_post_build ) \
- 3> >(tee -a "$C_LOG") \
- 2> >(tee -a "$C_LOG" >& "$VOYEUR_STDERR") \
- > >(tee -a "$C_LOG" >& "$VOYEUR_STDOUT")
+ (
+ run_post_build
+ ) 3> >(tee -a $C_LOG >> /dev/stdout) \
+ 2> >(tee -a $C_LOG 1>&2 > $VOYEUR_STDERR) \
+ > >(tee -a $C_LOG > $VOYEUR_STDOUT)
}

delve_post_install() {
debug "delve" "Running $FUNCNAME"
delve_is_valid_step POST_INSTALL 1 2 || return 1
delve_log_helper
- ( run_post_install ) \
- 3> >(tee -a "$C_LOG") \
- 2> >(tee -a "$C_LOG" >& "$VOYEUR_STDERR") \
- > >(tee -a "$C_LOG" >& "$VOYEUR_STDOUT")
+ (
+ run_post_install
+ ) 3> >(tee -a $C_LOG >> /dev/stdout) \
+ 2> >(tee -a $C_LOG 1>&2 > $VOYEUR_STDERR) \
+ > >(tee -a $C_LOG > $VOYEUR_STDOUT)
}

delve_transfer() {
debug "delve" "Running $FUNCNAME"
delve_is_valid_step TRANSFER 2 || return 1
delve_log_helper
- ( run_transfer ) \
- 3> >(tee -a "$C_LOG") \
- 2> >(tee -a "$C_LOG" >& "$VOYEUR_STDERR") \
- > >(tee -a "$C_LOG" >& "$VOYEUR_STDOUT")
+ (
+ run_transfer
+ ) 3> >(tee -a $C_LOG >> /dev/stdout) \
+ 2> >(tee -a $C_LOG 1>&2 > $VOYEUR_STDERR) \
+ > >(tee -a $C_LOG > $VOYEUR_STDOUT)
}

delve_final() {
@@ -277,10 +277,12 @@ delve_final() {
delve_log_helper
devoke_installwatch &&
STAGED_INSTALL=off
- ( run_final ) \
- 3> >(tee -a "$C_LOG") \
- 2> >(tee -a "$C_LOG" >& "$VOYEUR_STDERR") \
- > >(tee -a "$C_LOG" >& "$VOYEUR_STDOUT")
+ (
+ run_final
+ ) 3> >(tee -a $C_LOG >> /dev/stdout) \
+ 2> >(tee -a $C_LOG 1>&2 > $VOYEUR_STDERR) \
+ > >(tee -a $C_LOG > $VOYEUR_STDOUT)
+
}

delve_triggers() {
diff --git a/var/lib/sorcery/modules/build_api/api1
b/var/lib/sorcery/modules/build_api/api1
index 777814b..ad90377 100755
--- a/var/lib/sorcery/modules/build_api/api1
+++ b/var/lib/sorcery/modules/build_api/api1
@@ -30,13 +30,19 @@ run_build_spell() {
STAGED_INSTALL=off
rm -f $C_LOG
touch $C_LOG
- reserve_fds VOYEUR_STDOUT VOYEUR_STDERR
if [[ $SCREEN_NAME ]] ; then
screen_new_window "$SCREEN_NAME" $SCREEN_CAST_WIN "cast $SPELL" \
tail -f -s 0.1 $C_LOG
screen_switch_window "$SCREEN_NAME" $SCREEN_MAIN_WIN
+
+ VOYEUR_STDOUT=/dev/null
+ VOYEUR_STDERR=/dev/null
elif [ "$VOYEUR" == "on" -a -z "$SILENT" ] ; then
- eval "exec $((VOYEUR_STDOUT))>&1 $((VOYEUR_STDERR))>&2"
+ VOYEUR_STDOUT=/dev/stdout
+ VOYEUR_STDERR=/dev/stderr
+ else
+ VOYEUR_STDOUT=/dev/null
+ VOYEUR_STDERR=/dev/null
fi
# should OPTS get set here?

@@ -116,9 +122,10 @@ run_build() {
message "$SPELL $VERSION"

run_config_loc
- ( run_spell_file BUILD build ) \
- 2> >(tee -a "$C_LOG" >& "$VOYEUR_STDERR") \
- > >(tee -a "$C_LOG" >& "$VOYEUR_STDOUT")
+ (
+ run_spell_file BUILD build
+ ) 2> >(tee -a $C_LOG 1>&2 >> $VOYEUR_STDERR) \
+ > >(tee -a $C_LOG >> $VOYEUR_STDOUT) # see bug 7201

if [ "$?" != 0 ]; then
message "${PROBLEM_COLOR}" \
diff --git a/var/lib/sorcery/modules/build_api/api2
b/var/lib/sorcery/modules/build_api/api2
index 0c7c949..abfceea 100755
--- a/var/lib/sorcery/modules/build_api/api2
+++ b/var/lib/sorcery/modules/build_api/api2
@@ -36,16 +36,24 @@ run_build_spell() {
export VOYEUR_STDOUT VOYEUR_STDERR
export __DELVE_IN_CAST=on

- >"$CASTFS_DBGLOG"
- >"$C_LOG"
+ rm -f $CASTFS_DBGLOG
+ touch $CASTFS_DBGLOG
+ rm -f $C_LOG
+ touch $C_LOG

- reserve_fds VOYEUR_STDOUT VOYEUR_STDERR
if [[ $SCREEN_NAME ]] ; then
screen_new_window "$SCREEN_NAME" $SCREEN_CAST_WIN "cast $SPELL" \
- tail -f -s 0.1 "$C_LOG"
+ tail -f -s 0.1 $C_LOG
screen_switch_window "$SCREEN_NAME" $SCREEN_MAIN_WIN
+
+ VOYEUR_STDOUT=/dev/null
+ VOYEUR_STDERR=/dev/null
elif [ "$VOYEUR" == "on" -a -z "$SILENT" ] ; then
- eval "exec $((VOYEUR_STDOUT))>&1 $((VOYEUR_STDERR))>&2"
+ VOYEUR_STDOUT=/dev/stdout
+ VOYEUR_STDERR=/dev/stderr
+ else
+ VOYEUR_STDOUT=/dev/null
+ VOYEUR_STDERR=/dev/null
fi

if [[ -z $STAGED_INSTALL ]]
@@ -84,9 +92,9 @@ run_build_spell() {
devoke_installwatch &&
STAGED_INSTALL=off &&
run_final | append_to_notice_log || return 3
- ) 3> >(tee -a "$C_LOG") \
- 2> >(tee -a "$C_LOG" >& "$VOYEUR_STDERR") \
- > >(tee -a "$C_LOG" >& "$VOYEUR_STDOUT")
+ ) 3> >(tee -a $C_LOG >> /dev/stdout) \
+ 2> >(tee -a $C_LOG 1>&2 >> $VOYEUR_STDERR) \
+ > >(tee -a $C_LOG >> $VOYEUR_STDOUT) \
)
rs=$?
unset __DELVE_IN_CAST
diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index 5f862cc..c4ba9c6 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -1764,23 +1764,6 @@ show_file() {
}

#---------------------------------------------------------------------
-##
-## Reserve file descriptors; connects them to /dev/null.
-##
-#---------------------------------------------------------------------
-SORCERY_LAST_RESERVED_FD=2
-reserve_fds() {
- while [ $# -gt 0 ]; do
- if ! : >& "$((SORCERY_LAST_RESERVED_FD))"; then
- eval "$1=$((SORCERY_LAST_RESERVED_FD)) &&
- exec $((SORCERY_LAST_RESERVED_FD))> /dev/null" &&
- shift
- fi 2>/dev/null
- let ++SORCERY_LAST_RESERVED_FD
- done
-}
-
-#---------------------------------------------------------------------
## @param title
## @Globals TERM
##



  • [SM-Commit] GIT changes to master sorcery by Ismael Luceno (80d53a2f46b2f848598059d22f12cde44be3c2d2), Ismael Luceno, 10/14/2023

Archive powered by MHonArc 2.6.24.

Top of Page