From jonessyue at qnap.com Thu Feb 1 03:17:09 2024 From: jonessyue at qnap.com (=?iso-2022-jp?B?Sm9uZXMgU3l1ZSAbJEJpLVhnPSEbKEI=?=) Date: Thu, 1 Feb 2024 03:17:09 +0000 Subject: [V2 PATCH] crond: log5 fix typo, replace log level '4' with '5' In-Reply-To: References: Message-ID: Found previous patch accidentally adds 'x' permission to file 'crond.c', attached v2 patch would not change permissions of file 'crond.c', thank you :) -- Regards, Jones Syue | ??? QNAP Systems, Inc. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: v2-crond-log5.txt URL: From Christian.Franke at t-online.de Thu Feb 1 12:42:00 2024 From: Christian.Franke at t-online.de (Christian Franke) Date: Thu, 1 Feb 2024 13:42:00 +0100 Subject: [PATCH 2/3] Cygwin: re-enable build In-Reply-To: References: Message-ID: Thanks for pushing PATCH 1/3 of this series in November 2023 (commit a63b60b). On Mon, 9 Oct 2023 19:01:02 +0200, Christian Franke wrote: > The file cygwin_defconfig exists since 2011 but the actual build is > likely broken since 2014. > > Unfortunately the ugly hack in libbb.h is required to fix this or > busybox itoa/utoa would need to be renamed. > See also: > http://lists.busybox.net/pipermail/busybox/2023-September/090462.html > https://cplusplus.com/reference/cstdlib/itoa/ > Fortunately the hack in libbb.h is no longer needed. The conflicting prototypes are now disabled: https://cygwin.com/git/?p=newlib-cygwin.git;a=commitdiff;h=31f7cd1 A new version of the patch is attached. The diff of cygwin_defconfig is unchanged. -- Regards, Christian -------------- next part -------------- From f6f93890b7fc4532eb2351b4cc5ace836717d31b Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Thu, 1 Feb 2024 13:20:13 +0100 Subject: [PATCH] Cygwin: re-enable build cygwin_defconfig: Disable all applets and features which do not compile without further code changes or are not useful on Cygwin. Set correct OSNAME. Signed-off-by: Christian Franke --- configs/cygwin_defconfig | 308 +++++++++++++++++++-------------------- 1 file changed, 150 insertions(+), 158 deletions(-) diff --git a/configs/cygwin_defconfig b/configs/cygwin_defconfig index 61e2c2463..2fcf45012 100644 --- a/configs/cygwin_defconfig +++ b/configs/cygwin_defconfig @@ -28,7 +28,7 @@ CONFIG_BUSYBOX=y CONFIG_FEATURE_SHOW_SCRIPT=y CONFIG_FEATURE_INSTALLER=y # CONFIG_INSTALL_NO_USR is not set -CONFIG_FEATURE_SUID=y +# CONFIG_FEATURE_SUID is not set # CONFIG_FEATURE_SUID_CONFIG is not set # CONFIG_FEATURE_SUID_CONFIG_QUIET is not set # CONFIG_FEATURE_PREFER_APPLETS is not set @@ -95,12 +95,12 @@ CONFIG_FEATURE_BUFFERS_USE_MALLOC=y CONFIG_PASSWORD_MINLEN=6 CONFIG_MD5_SMALL=1 CONFIG_SHA1_SMALL=3 -CONFIG_SHA1_HWACCEL=y -CONFIG_SHA256_HWACCEL=y +# CONFIG_SHA1_HWACCEL is not set +# CONFIG_SHA256_HWACCEL is not set CONFIG_SHA3_SMALL=1 CONFIG_FEATURE_NON_POSIX_CP=y # CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set -CONFIG_FEATURE_USE_SENDFILE=y +# CONFIG_FEATURE_USE_SENDFILE is not set CONFIG_FEATURE_COPYBUF_KB=4 # CONFIG_MONOTONIC_SYSCALL is not set CONFIG_IOCTL_HEX2STR_ERROR=y @@ -326,7 +326,7 @@ CONFIG_FEATURE_SPLIT_FANCY=y CONFIG_STTY=y CONFIG_SUM=y CONFIG_SYNC=y -CONFIG_FEATURE_SYNC_FANCY=y +# CONFIG_FEATURE_SYNC_FANCY is not set CONFIG_FSYNC=y CONFIG_TAC=y CONFIG_TAIL=y @@ -348,7 +348,7 @@ CONFIG_TRUNCATE=y CONFIG_TSORT=y CONFIG_TTY=y CONFIG_UNAME=y -CONFIG_UNAME_OSNAME="GNU/Linux" +CONFIG_UNAME_OSNAME="Cygwin" CONFIG_BB_ARCH=y CONFIG_UNIQ=y CONFIG_UNLINK=y @@ -408,8 +408,8 @@ CONFIG_WHICH=y # # CONFIG_MINIPS is not set # CONFIG_NUKE is not set -CONFIG_RESUME=y -CONFIG_RUN_INIT=y +# CONFIG_RESUME is not set +# CONFIG_RUN_INIT is not set # # Editors @@ -501,9 +501,9 @@ CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE=y # CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set # CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set # CONFIG_HALT is not set -CONFIG_POWEROFF=y -CONFIG_REBOOT=y -CONFIG_FEATURE_WAIT_FOR_INIT=y +# CONFIG_POWEROFF is not set +# CONFIG_REBOOT is not set +# CONFIG_FEATURE_WAIT_FOR_INIT is not set # CONFIG_FEATURE_CALL_TELINIT is not set CONFIG_TELINIT_PATH="" # CONFIG_INIT is not set @@ -521,46 +521,46 @@ CONFIG_INIT_TERMINAL_TYPE="" # # Login/Password Management Utilities # -CONFIG_FEATURE_SHADOWPASSWDS=y -CONFIG_USE_BB_PWD_GRP=y -CONFIG_USE_BB_SHADOW=y +# CONFIG_FEATURE_SHADOWPASSWDS is not set +# CONFIG_USE_BB_PWD_GRP is not set +# CONFIG_USE_BB_SHADOW is not set CONFIG_USE_BB_CRYPT=y CONFIG_USE_BB_CRYPT_SHA=y CONFIG_ADD_SHELL=y CONFIG_REMOVE_SHELL=y -CONFIG_ADDGROUP=y -CONFIG_FEATURE_ADDUSER_TO_GROUP=y -CONFIG_ADDUSER=y +# CONFIG_ADDGROUP is not set +# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set +# CONFIG_ADDUSER is not set # CONFIG_FEATURE_CHECK_NAMES is not set -CONFIG_LAST_ID=60000 -CONFIG_FIRST_SYSTEM_ID=100 -CONFIG_LAST_SYSTEM_ID=999 -CONFIG_CHPASSWD=y +CONFIG_LAST_ID=0 +CONFIG_FIRST_SYSTEM_ID=0 +CONFIG_LAST_SYSTEM_ID=0 +# CONFIG_CHPASSWD is not set CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="des" CONFIG_CRYPTPW=y -CONFIG_MKPASSWD=y -CONFIG_DELUSER=y -CONFIG_DELGROUP=y -CONFIG_FEATURE_DEL_USER_FROM_GROUP=y +# CONFIG_MKPASSWD is not set +# CONFIG_DELUSER is not set +# CONFIG_DELGROUP is not set +# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set # CONFIG_GETTY is not set CONFIG_LOGIN=y # CONFIG_LOGIN_SESSION_AS_CHILD is not set -CONFIG_LOGIN_SCRIPTS=y -CONFIG_FEATURE_NOLOGIN=y -CONFIG_FEATURE_SECURETTY=y -CONFIG_PASSWD=y -CONFIG_FEATURE_PASSWD_WEAK_CHECK=y -CONFIG_SU=y -CONFIG_FEATURE_SU_SYSLOG=y -CONFIG_FEATURE_SU_CHECKS_SHELLS=y +# CONFIG_LOGIN_SCRIPTS is not set +# CONFIG_FEATURE_NOLOGIN is not set +# CONFIG_FEATURE_SECURETTY is not set +# CONFIG_PASSWD is not set +# CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set +# CONFIG_SU is not set +# CONFIG_FEATURE_SU_SYSLOG is not set +# CONFIG_FEATURE_SU_CHECKS_SHELLS is not set # CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set -CONFIG_SULOGIN=y -CONFIG_VLOCK=y +# CONFIG_SULOGIN is not set +# CONFIG_VLOCK is not set # # Linux Ext2 FS Progs # -CONFIG_CHATTR=y +# CONFIG_CHATTR is not set # CONFIG_FSCK is not set # CONFIG_LSATTR is not set # CONFIG_TUNE2FS is not set @@ -601,18 +601,18 @@ CONFIG_DEFAULT_DEPMOD_FILE="" # # CONFIG_ACPID is not set # CONFIG_FEATURE_ACPID_COMPAT is not set -CONFIG_BLKDISCARD=y +# CONFIG_BLKDISCARD is not set # CONFIG_BLKID is not set # CONFIG_FEATURE_BLKID_TYPE is not set # CONFIG_BLOCKDEV is not set CONFIG_CAL=y -CONFIG_CHRT=y +# CONFIG_CHRT is not set # CONFIG_DMESG is not set # CONFIG_FEATURE_DMESG_PRETTY is not set # CONFIG_EJECT is not set # CONFIG_FEATURE_EJECT_SCSI is not set CONFIG_FALLOCATE=y -CONFIG_FATATTR=y +# CONFIG_FATATTR is not set # CONFIG_FBSET is not set # CONFIG_FEATURE_FBSET_FANCY is not set # CONFIG_FEATURE_FBSET_READMODE is not set @@ -630,9 +630,9 @@ CONFIG_FATATTR=y CONFIG_FLOCK=y # CONFIG_FDFLUSH is not set # CONFIG_FREERAMDISK is not set -CONFIG_FSCK_MINIX=y -CONFIG_FSFREEZE=y -CONFIG_FSTRIM=y +# CONFIG_FSCK_MINIX is not set +# CONFIG_FSFREEZE is not set +# CONFIG_FSTRIM is not set CONFIG_GETOPT=y CONFIG_FEATURE_GETOPT_LONG=y CONFIG_HEXDUMP=y @@ -657,15 +657,15 @@ CONFIG_IPCRM=y # CONFIG_FEATURE_MDEV_DAEMON is not set CONFIG_MESG=y CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP=y -CONFIG_MKE2FS=y +# CONFIG_MKE2FS is not set # CONFIG_MKFS_EXT2 is not set # CONFIG_MKFS_MINIX is not set -CONFIG_FEATURE_MINIX2=y +# CONFIG_FEATURE_MINIX2 is not set # CONFIG_MKFS_REISER is not set -CONFIG_MKDOSFS=y +# CONFIG_MKDOSFS is not set # CONFIG_MKFS_VFAT is not set -CONFIG_MKSWAP=y -CONFIG_FEATURE_MKSWAP_UUID=y +# CONFIG_MKSWAP is not set +# CONFIG_FEATURE_MKSWAP_UUID is not set CONFIG_MORE=y # CONFIG_MOUNT is not set # CONFIG_FEATURE_MOUNT_FAKE is not set @@ -678,55 +678,51 @@ CONFIG_MORE=y # CONFIG_FEATURE_MOUNT_FSTAB is not set # CONFIG_FEATURE_MOUNT_OTHERTAB is not set # CONFIG_MOUNTPOINT is not set -CONFIG_NOLOGIN=y +# CONFIG_NOLOGIN is not set # CONFIG_NOLOGIN_DEPENDENCIES is not set -CONFIG_NSENTER=y +# CONFIG_NSENTER is not set # CONFIG_PIVOT_ROOT is not set # CONFIG_RDATE is not set -CONFIG_RDEV=y -CONFIG_READPROFILE=y +# CONFIG_RDEV is not set +# CONFIG_READPROFILE is not set CONFIG_RENICE=y CONFIG_REV=y # CONFIG_RTCWAKE is not set CONFIG_SCRIPT=y CONFIG_SCRIPTREPLAY=y # CONFIG_SETARCH is not set -CONFIG_LINUX32=y -CONFIG_LINUX64=y -CONFIG_SETPRIV=y -CONFIG_FEATURE_SETPRIV_DUMP=y -CONFIG_FEATURE_SETPRIV_CAPABILITIES=y -CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES=y +# CONFIG_LINUX32 is not set +# CONFIG_LINUX64 is not set +# CONFIG_SETPRIV is not set +# CONFIG_FEATURE_SETPRIV_DUMP is not set +# CONFIG_FEATURE_SETPRIV_CAPABILITIES is not set +# CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES is not set CONFIG_SETSID=y -CONFIG_SWAPON=y -CONFIG_FEATURE_SWAPON_DISCARD=y +# CONFIG_SWAPON is not set +# CONFIG_FEATURE_SWAPON_DISCARD is not set # CONFIG_FEATURE_SWAPON_PRI is not set -CONFIG_SWAPOFF=y -CONFIG_FEATURE_SWAPONOFF_LABEL=y +# CONFIG_SWAPOFF is not set +# CONFIG_FEATURE_SWAPONOFF_LABEL is not set # CONFIG_SWITCH_ROOT is not set # CONFIG_TASKSET is not set # CONFIG_FEATURE_TASKSET_FANCY is not set # CONFIG_FEATURE_TASKSET_CPULIST is not set -CONFIG_UEVENT=y +# CONFIG_UEVENT is not set # CONFIG_UMOUNT is not set # CONFIG_FEATURE_UMOUNT_ALL is not set -CONFIG_UNSHARE=y +# CONFIG_UNSHARE is not set # CONFIG_WALL is not set # CONFIG_FEATURE_MOUNT_LOOP is not set # CONFIG_FEATURE_MOUNT_LOOP_CREATE is not set # CONFIG_FEATURE_MTAB_SUPPORT is not set -CONFIG_VOLUMEID=y - -# -# Filesystem/Volume identification -# -CONFIG_FEATURE_VOLUMEID_BCACHE=y +# CONFIG_VOLUMEID is not set +# CONFIG_FEATURE_VOLUMEID_BCACHE is not set # CONFIG_FEATURE_VOLUMEID_BTRFS is not set # CONFIG_FEATURE_VOLUMEID_CRAMFS is not set -CONFIG_FEATURE_VOLUMEID_EROFS=y -CONFIG_FEATURE_VOLUMEID_EXFAT=y +# CONFIG_FEATURE_VOLUMEID_EROFS is not set +# CONFIG_FEATURE_VOLUMEID_EXFAT is not set # CONFIG_FEATURE_VOLUMEID_EXT is not set -CONFIG_FEATURE_VOLUMEID_F2FS=y +# CONFIG_FEATURE_VOLUMEID_F2FS is not set # CONFIG_FEATURE_VOLUMEID_FAT is not set # CONFIG_FEATURE_VOLUMEID_HFS is not set # CONFIG_FEATURE_VOLUMEID_ISO9660 is not set @@ -735,15 +731,15 @@ CONFIG_FEATURE_VOLUMEID_F2FS=y # CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set # CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set # CONFIG_FEATURE_VOLUMEID_LUKS is not set -CONFIG_FEATURE_VOLUMEID_MINIX=y -CONFIG_FEATURE_VOLUMEID_NILFS=y +# CONFIG_FEATURE_VOLUMEID_MINIX is not set +# CONFIG_FEATURE_VOLUMEID_NILFS is not set # CONFIG_FEATURE_VOLUMEID_NTFS is not set # CONFIG_FEATURE_VOLUMEID_OCFS2 is not set # CONFIG_FEATURE_VOLUMEID_REISERFS is not set # CONFIG_FEATURE_VOLUMEID_ROMFS is not set # CONFIG_FEATURE_VOLUMEID_SQUASHFS is not set # CONFIG_FEATURE_VOLUMEID_SYSV is not set -CONFIG_FEATURE_VOLUMEID_UBIFS=y +# CONFIG_FEATURE_VOLUMEID_UBIFS is not set # CONFIG_FEATURE_VOLUMEID_UDF is not set # CONFIG_FEATURE_VOLUMEID_XFS is not set @@ -783,7 +779,7 @@ CONFIG_CRONTAB=y # CONFIG_DEVFSD_FG_NP is not set # CONFIG_DEVFSD_VERBOSE is not set # CONFIG_FEATURE_DEVFS is not set -CONFIG_DEVMEM=y +# CONFIG_DEVMEM is not set # CONFIG_FBSPLASH is not set # CONFIG_FLASH_ERASEALL is not set # CONFIG_FLASH_LOCK is not set @@ -798,11 +794,11 @@ CONFIG_GETFATTR=y # CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set # CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set CONFIG_HEXEDIT=y -CONFIG_I2CGET=y -CONFIG_I2CSET=y -CONFIG_I2CDUMP=y -CONFIG_I2CDETECT=y -CONFIG_I2CTRANSFER=y +# CONFIG_I2CGET is not set +# CONFIG_I2CSET is not set +# CONFIG_I2CDUMP is not set +# CONFIG_I2CDETECT is not set +# CONFIG_I2CTRANSFER is not set # CONFIG_INOTIFYD is not set CONFIG_LESS=y CONFIG_FEATURE_LESS_MAXLINES=9999999 @@ -817,7 +813,7 @@ CONFIG_FEATURE_LESS_DASHCMD=y CONFIG_FEATURE_LESS_LINENUMS=y CONFIG_FEATURE_LESS_RAW=y CONFIG_FEATURE_LESS_ENV=y -CONFIG_LSSCSI=y +# CONFIG_LSSCSI is not set # CONFIG_MAKEDEVS is not set # CONFIG_FEATURE_MAKEDEVS_LEAF is not set # CONFIG_FEATURE_MAKEDEVS_TABLE is not set @@ -827,13 +823,13 @@ CONFIG_MIM=y CONFIG_MT=y # CONFIG_NANDWRITE is not set # CONFIG_NANDDUMP is not set -CONFIG_PARTPROBE=y +# CONFIG_PARTPROBE is not set # CONFIG_RAIDAUTORUN is not set # CONFIG_READAHEAD is not set # CONFIG_RFKILL is not set # CONFIG_RUNLEVEL is not set # CONFIG_RX is not set -CONFIG_SEEDRNG=y +# CONFIG_SEEDRNG is not set CONFIG_SETFATTR=y # CONFIG_SETSERIAL is not set CONFIG_STRINGS=y @@ -847,7 +843,7 @@ CONFIG_TTYSIZE=y # CONFIG_UBIRMVOL is not set # CONFIG_UBIRSVOL is not set # CONFIG_UBIUPDATEVOL is not set -CONFIG_UBIRENAME=y +# CONFIG_UBIRENAME is not set CONFIG_VOLNAME=y # CONFIG_WATCHDOG is not set # CONFIG_FEATURE_WATCHDOG_OPEN_TWICE is not set @@ -868,7 +864,7 @@ CONFIG_FEATURE_HWIB=y # CONFIG_BRCTL is not set # CONFIG_FEATURE_BRCTL_FANCY is not set # CONFIG_FEATURE_BRCTL_SHOW is not set -CONFIG_DNSD=y +# CONFIG_DNSD is not set # CONFIG_ETHER_WAKE is not set CONFIG_FTPD=y CONFIG_FEATURE_FTPD_WRITE=y @@ -904,8 +900,8 @@ CONFIG_FEATURE_HTTPD_ACL_IP=y # CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set # CONFIG_IFENSLAVE is not set # CONFIG_IFPLUGD is not set -CONFIG_IFUP=y -CONFIG_IFDOWN=y +# CONFIG_IFUP is not set +# CONFIG_IFDOWN is not set CONFIG_IFUPDOWN_IFSTATE_PATH="" # CONFIG_FEATURE_IFUPDOWN_IP is not set # CONFIG_FEATURE_IFUPDOWN_IPV4 is not set @@ -925,14 +921,14 @@ CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN=y # CONFIG_IPROUTE is not set # CONFIG_IPTUNNEL is not set # CONFIG_IPRULE is not set -CONFIG_IPNEIGH=y +# CONFIG_IPNEIGH is not set # CONFIG_FEATURE_IP_ADDRESS is not set # CONFIG_FEATURE_IP_LINK is not set # CONFIG_FEATURE_IP_ROUTE is not set CONFIG_FEATURE_IP_ROUTE_DIR="" # CONFIG_FEATURE_IP_TUNNEL is not set # CONFIG_FEATURE_IP_RULE is not set -CONFIG_FEATURE_IP_NEIGH=y +# CONFIG_FEATURE_IP_NEIGH is not set # CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set CONFIG_IPCALC=y CONFIG_FEATURE_IPCALC_LONG_OPTIONS=y @@ -941,10 +937,10 @@ CONFIG_FAKEIDENTD=y # CONFIG_NAMEIF is not set # CONFIG_FEATURE_NAMEIF_EXTENDED is not set # CONFIG_NBDCLIENT is not set -CONFIG_NC=y +# CONFIG_NC is not set # CONFIG_NETCAT is not set -CONFIG_NC_SERVER=y -CONFIG_NC_EXTRA=y +# CONFIG_NC_SERVER is not set +# CONFIG_NC_EXTRA is not set # CONFIG_NC_110_COMPAT is not set # CONFIG_NETSTAT is not set # CONFIG_FEATURE_NETSTAT_WIDE is not set @@ -963,10 +959,10 @@ CONFIG_PSCAN=y # CONFIG_ROUTE is not set # CONFIG_SLATTACH is not set CONFIG_SSL_CLIENT=y -CONFIG_TC=y -CONFIG_FEATURE_TC_INGRESS=y -CONFIG_TCPSVD=y -CONFIG_UDPSVD=y +# CONFIG_TC is not set +# CONFIG_FEATURE_TC_INGRESS is not set +# CONFIG_TCPSVD is not set +# CONFIG_UDPSVD is not set CONFIG_TELNET=y CONFIG_FEATURE_TELNET_TTYPE=y CONFIG_FEATURE_TELNET_AUTOLOGIN=y @@ -975,13 +971,13 @@ CONFIG_TELNETD=y CONFIG_FEATURE_TELNETD_STANDALONE=y CONFIG_FEATURE_TELNETD_PORT_DEFAULT=23 CONFIG_FEATURE_TELNETD_INETD_WAIT=y -CONFIG_TFTP=y -CONFIG_FEATURE_TFTP_PROGRESS_BAR=y -CONFIG_FEATURE_TFTP_HPA_COMPAT=y -CONFIG_TFTPD=y -CONFIG_FEATURE_TFTP_GET=y -CONFIG_FEATURE_TFTP_PUT=y -CONFIG_FEATURE_TFTP_BLOCKSIZE=y +# CONFIG_TFTP is not set +# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set +# CONFIG_FEATURE_TFTP_HPA_COMPAT is not set +# CONFIG_TFTPD is not set +# CONFIG_FEATURE_TFTP_GET is not set +# CONFIG_FEATURE_TFTP_PUT is not set +# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set # CONFIG_TFTP_DEBUG is not set CONFIG_TLS=y # CONFIG_TRACEROUTE is not set @@ -998,7 +994,7 @@ CONFIG_FEATURE_WGET_FTP=y CONFIG_FEATURE_WGET_AUTHENTICATION=y CONFIG_FEATURE_WGET_TIMEOUT=y CONFIG_FEATURE_WGET_HTTPS=y -CONFIG_FEATURE_WGET_OPENSSL=y +# CONFIG_FEATURE_WGET_OPENSSL is not set CONFIG_WHOIS=y # CONFIG_ZCIP is not set # CONFIG_UDHCPD is not set @@ -1012,17 +1008,13 @@ CONFIG_DHCPD_LEASES_FILE="" # CONFIG_FEATURE_UDHCPC_ARPING is not set # CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set CONFIG_UDHCPC_DEFAULT_SCRIPT="" -CONFIG_UDHCPC6_DEFAULT_SCRIPT="/usr/share/udhcpc/default6.script" -CONFIG_UDHCPC6=y -CONFIG_FEATURE_UDHCPC6_RFC3646=y -CONFIG_FEATURE_UDHCPC6_RFC4704=y -CONFIG_FEATURE_UDHCPC6_RFC4833=y -CONFIG_FEATURE_UDHCPC6_RFC5970=y - -# -# Common options for DHCP applets -# -CONFIG_UDHCPC_DEFAULT_INTERFACE="eth0" +CONFIG_UDHCPC6_DEFAULT_SCRIPT="" +# CONFIG_UDHCPC6 is not set +# CONFIG_FEATURE_UDHCPC6_RFC3646 is not set +# CONFIG_FEATURE_UDHCPC6_RFC4704 is not set +# CONFIG_FEATURE_UDHCPC6_RFC4833 is not set +# CONFIG_FEATURE_UDHCPC6_RFC5970 is not set +CONFIG_UDHCPC_DEFAULT_INTERFACE="" # CONFIG_FEATURE_UDHCP_PORT is not set CONFIG_UDHCP_DEBUG=0 CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0 @@ -1051,11 +1043,11 @@ CONFIG_SENDMAIL=y # # Process Utilities # -CONFIG_FEATURE_FAST_TOP=y +# CONFIG_FEATURE_FAST_TOP is not set # CONFIG_FEATURE_SHOW_THREADS is not set # CONFIG_FREE is not set CONFIG_FUSER=y -CONFIG_IOSTAT=y +# CONFIG_IOSTAT is not set CONFIG_KILL=y CONFIG_KILLALL=y CONFIG_KILLALL5=y @@ -1078,16 +1070,16 @@ CONFIG_PS=y CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y CONFIG_PSTREE=y CONFIG_PWDX=y -CONFIG_SMEMCAP=y -CONFIG_BB_SYSCTL=y +# CONFIG_SMEMCAP is not set +# CONFIG_BB_SYSCTL is not set CONFIG_TOP=y CONFIG_FEATURE_TOP_INTERACTIVE=y CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y CONFIG_FEATURE_TOP_SMP_CPU=y CONFIG_FEATURE_TOP_DECIMALS=y -CONFIG_FEATURE_TOP_SMP_PROCESS=y -CONFIG_FEATURE_TOPMEM=y +# CONFIG_FEATURE_TOP_SMP_PROCESS is not set +# CONFIG_FEATURE_TOPMEM is not set # CONFIG_UPTIME is not set # CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set CONFIG_WATCH=y @@ -1151,42 +1143,42 @@ CONFIG_ASH_HELP=y CONFIG_ASH_GETOPTS=y CONFIG_ASH_CMDCMD=y # CONFIG_CTTYHACK is not set -CONFIG_HUSH=y -CONFIG_SHELL_HUSH=y -CONFIG_HUSH_BASH_COMPAT=y -CONFIG_HUSH_BRACE_EXPANSION=y +# CONFIG_HUSH is not set +# CONFIG_SHELL_HUSH is not set +# CONFIG_HUSH_BASH_COMPAT is not set +# CONFIG_HUSH_BRACE_EXPANSION is not set # CONFIG_HUSH_BASH_SOURCE_CURDIR is not set -CONFIG_HUSH_LINENO_VAR=y -CONFIG_HUSH_INTERACTIVE=y -CONFIG_HUSH_SAVEHISTORY=y -CONFIG_HUSH_JOB=y -CONFIG_HUSH_TICK=y -CONFIG_HUSH_IF=y -CONFIG_HUSH_LOOPS=y -CONFIG_HUSH_CASE=y -CONFIG_HUSH_FUNCTIONS=y -CONFIG_HUSH_LOCAL=y -CONFIG_HUSH_RANDOM_SUPPORT=y -CONFIG_HUSH_MODE_X=y -CONFIG_HUSH_ECHO=y -CONFIG_HUSH_PRINTF=y -CONFIG_HUSH_TEST=y -CONFIG_HUSH_HELP=y -CONFIG_HUSH_EXPORT=y -CONFIG_HUSH_EXPORT_N=y -CONFIG_HUSH_READONLY=y -CONFIG_HUSH_KILL=y -CONFIG_HUSH_WAIT=y -CONFIG_HUSH_COMMAND=y -CONFIG_HUSH_TRAP=y -CONFIG_HUSH_TYPE=y -CONFIG_HUSH_TIMES=y -CONFIG_HUSH_READ=y -CONFIG_HUSH_SET=y -CONFIG_HUSH_UNSET=y -CONFIG_HUSH_ULIMIT=y -CONFIG_HUSH_UMASK=y -CONFIG_HUSH_GETOPTS=y +# CONFIG_HUSH_LINENO_VAR is not set +# CONFIG_HUSH_INTERACTIVE is not set +# CONFIG_HUSH_SAVEHISTORY is not set +# CONFIG_HUSH_JOB is not set +# CONFIG_HUSH_TICK is not set +# CONFIG_HUSH_IF is not set +# CONFIG_HUSH_LOOPS is not set +# CONFIG_HUSH_CASE is not set +# CONFIG_HUSH_FUNCTIONS is not set +# CONFIG_HUSH_LOCAL is not set +# CONFIG_HUSH_RANDOM_SUPPORT is not set +# CONFIG_HUSH_MODE_X is not set +# CONFIG_HUSH_ECHO is not set +# CONFIG_HUSH_PRINTF is not set +# CONFIG_HUSH_TEST is not set +# CONFIG_HUSH_HELP is not set +# CONFIG_HUSH_EXPORT is not set +# CONFIG_HUSH_EXPORT_N is not set +# CONFIG_HUSH_READONLY is not set +# CONFIG_HUSH_KILL is not set +# CONFIG_HUSH_WAIT is not set +# CONFIG_HUSH_COMMAND is not set +# CONFIG_HUSH_TRAP is not set +# CONFIG_HUSH_TYPE is not set +# CONFIG_HUSH_TIMES is not set +# CONFIG_HUSH_READ is not set +# CONFIG_HUSH_SET is not set +# CONFIG_HUSH_UNSET is not set +# CONFIG_HUSH_ULIMIT is not set +# CONFIG_HUSH_UMASK is not set +# CONFIG_HUSH_GETOPTS is not set # CONFIG_HUSH_MEMLEAK is not set # @@ -1219,4 +1211,4 @@ CONFIG_FEATURE_SYSLOGD_CFG=y CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256 CONFIG_FEATURE_IPC_SYSLOG=y CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16 -CONFIG_FEATURE_KMSG_SYSLOG=y +# CONFIG_FEATURE_KMSG_SYSLOG is not set -- 2.43.0 From akash.hadke27 at gmail.com Mon Feb 5 09:45:38 2024 From: akash.hadke27 at gmail.com (Akash Hadke) Date: Mon, 5 Feb 2024 15:15:38 +0530 Subject: [PATCH] zcip: add support for DoIP/ISO 13400 timings Message-ID: Hello, The attached patch is for adding a new compile time option for zcip. DoIP requires fast IP assignment, faster than what RFC 3927 can guarantee, and so it defines its' own AutoIP timing parameters Add a compile-time option to use DoIP timing parameters instead of default RFC 3927 parameters. This option is helpful for the use of zcip in automotive use cases. In practice, it decreases AutoIP allocation time from ~10s to ~2s, at the expense of less resilience to collisions Kindly check the patch. Thanks and Regards, Akash Hadke -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-zcip-add-support-for-DoIP-ISO-13400-timings.patch Type: text/x-patch Size: 6508 bytes Desc: not available URL: From Matthew.Chae at axis.com Mon Feb 5 09:56:20 2024 From: Matthew.Chae at axis.com (Matthew Chae) Date: Mon, 5 Feb 2024 09:56:20 +0000 Subject: fix large PID overflow their column in top command In-Reply-To: <4458638ee54e4ae7a47a9586de9b874d@AcuMS.aculab.com> References: <4458638ee54e4ae7a47a9586de9b874d@AcuMS.aculab.com> Message-ID: Hi David, I'm sending an improved patch based on your comments. Not only does it not care about the PID_MAX value, it searches all the contents to be output to recognize the required column width and dynamically allocates the space for PID and PPID appropriately without creating a lot of empty space. Additionally, this patch still allows user names to be displayed up to 8 characters without truncation. Can you look through the attachment? (0002-Allocate-PID-PPID-space-dynamically-in-top-command.patch) BR-Matthew Chae ________________________________ From: David Laight Sent: Thursday, November 23, 2023 6:10 PM To: 'Denys Vlasenko' ; Matthew Chae Cc: busybox at busybox.net ; Christopher Wong Subject: RE: fix large PID overflow their column in top command ... > + fp = xfopen_for_read("/proc/sys/kernel/pid_max"); > + if (!fgets(pid_buf, PID_DIGITS_MAX + 1, fp)) { > ... > + if (strncmp(pid_buf, "32768", 5) == 0) > + pid_digits_num = 5; > + else > + pid_digits_num = PID_DIGITS_MAX; > > The logic above is not sound. Even if sysctl kernel.pid_max > is 32768, there can be already running processes with pids > 99999. It's also probably wrong for pretty much all other values. I'd just base the column width on strlen(pid_buf) with a minimum value of 5. It is unlikely that pid_max has been reduced - so column overflow it that case probably doesn't really matter. The more interesting case is really a system with a very large pid_max that has never run many processes. You don't really want lots of blank space. I can't remember whether top reads everything before doing any output? Since the output is sorted it probably almost always does. In which case it knows the column width it will need. I did post a patch a while back that enabled 'Irix mode'. (100% cpu is one cpu at 100%, not all cpus at 100%) Maybe I should dig it out again. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Allocate-PID-PPID-space-dynamically-in-top-command.patch Type: text/x-patch Size: 4234 bytes Desc: 0002-Allocate-PID-PPID-space-dynamically-in-top-command.patch URL: From mdidomenico4 at gmail.com Tue Feb 6 18:47:22 2024 From: mdidomenico4 at gmail.com (Michael DiDomenico) Date: Tue, 6 Feb 2024 13:47:22 -0500 Subject: configuring selinux Message-ID: i've compiled 1.36.1 with selinux support, however, after pxe booting an initrd of busybox it doesn't look like any of the files are labelled and sestatus says selinux status: disabled sestatus: libselinux returns unknown state: no such file or directory cleary, i have something configured or not configured incorrectly. is there any documentation on getting a busybox image secured and labelled like a rhel image is? i haven't been able to come across anything, nearest are posts from the openwrt mailing list, but they haven't helped. -------------- next part -------------- An HTML attachment was scrubbed... URL: From yetanothergeek at gmail.com Wed Feb 7 13:55:03 2024 From: yetanothergeek at gmail.com (Jeff Pohlmeyer) Date: Wed, 7 Feb 2024 07:55:03 -0600 Subject: [PATCH] [1/2] modprobe: Add -S option to use a different kernel version Message-ID: (These two patches are somewhat related but do not depend on each other and can be applied separately.) Support -S to use another kernel version (66 bytes) Normally modprobe will use version information from the currently running kernel (similar to `uname -r`). This patch adds a compile-time configuration option to enable the -S switch, which allows specifying a different kernel version. This can be useful when used with the -D option to determine module dependencies when building a new initramfs after a kernel upgrade. function old new delta packed_usage 34776 34812 +36 modprobe_main 946 974 +28 .rodata 103911 103913 +2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 66/0) Total: 66 bytes text data bss dec hex filename 1180482 7435 4984 1192901 1233c5 busybox_old 1180548 7435 4984 1192967 123407 busybox_unstripped -------------- next part -------------- A non-text attachment was scrubbed... Name: modprobe-add-set-version-option.patch Type: text/x-patch Size: 3579 bytes Desc: not available URL: From yetanothergeek at gmail.com Wed Feb 7 13:57:16 2024 From: yetanothergeek at gmail.com (Jeff Pohlmeyer) Date: Wed, 7 Feb 2024 07:57:16 -0600 Subject: [PATCH] [2/2] modinfo: Add -k option to use a different kernel version Message-ID: (These two patches are somewhat related but do not depend on each other and can be applied separately.) Support -k to use another kernel version (30 bytes) Normally modinfo will use version information from the currently running kernel (similar to `uname -r`). This patch adds a compile-time configuration option to enable the -k switch, which allows specifying a different kernel version. This can be useful with the -F {depends,softdep} options to determine module dependencies when building a new initramfs aftera kernel upgrade. function old new delta modinfo_main 380 430 +50 .rodata 103911 103913 +2 packed_usage 34776 34754 -22 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 52/-22) Total: 30 bytes text data bss dec hex filename 1180482 7435 4984 1192901 1233c5 busybox_old 1180512 7435 4984 1192931 1233e3 busybox_unstripped -------------- next part -------------- A non-text attachment was scrubbed... Name: modinfo-add-set-version-option.patch Type: text/x-patch Size: 3029 bytes Desc: not available URL: From sertonix at posteo.net Thu Feb 8 22:22:41 2024 From: sertonix at posteo.net (Sertonix) Date: Thu, 08 Feb 2024 22:22:41 +0000 Subject: acpid: infinite loop with removed event device Message-ID: I encountered an issue with acpid where the cpu usage was continuesly 100%. I only saw the issue when acpid had 4 houres CPU time xD I am not sure where the issue lies. One odd thing I noticed is that /dev/input/event8 was deleted but is still an open file descriptor. If I have found the right memory the pollfd struct of the deleted file looks like this (from gdb examine): 0x0000000b 0x00190001 The fd is 11 which matches with 0x0000000b. If 0x0019 is the returned events that could explain the infinite loop. acpid only closes file descriptors when POLLIN is not set but the read always failed since the source was deleted. Args: /sbin/acpid -f The busybox version is from alpine linux edge with musl libc. If that is important. From dm.chestnykh at gmail.com Sat Feb 10 15:51:39 2024 From: dm.chestnykh at gmail.com (Dmitry Chestnykh) Date: Sat, 10 Feb 2024 18:51:39 +0300 Subject: [PATCH] hush: Prevent segfault at unexpected EOF in script. Message-ID: <20240210155139.184908-1-dm.chestnykh@gmail.com> See https://bugs.buildroot.org/show_bug.cgi?id=15937 . With this patch the execution of reproducer script from bugzilla leads to the following output: 'hush: syntax error: unexpected EOF' Signed-off-by: Dmitry Chestnykh --- shell/hush.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/shell/hush.c b/shell/hush.c index ca01e2b5b..0595ad592 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -6132,6 +6132,10 @@ static int expand_on_ifs(o_string *output, int n, const char *str) if (!*str) /* EOL - do not finalize word */ break; + + if (!G.ifs) + return -1; + word_len = strcspn(str, G.ifs); if (word_len) { /* We have WORD_LEN leading non-IFS chars */ @@ -6598,6 +6602,8 @@ static int append_str_maybe_ifs_split(o_string *output, int n, !!(output->o_expflags & EXP_FLAG_ESC_GLOB_CHARS)); if (val && val[0]) n = expand_on_ifs(output, n, val); + if (n < 0) + return n; } else { /* quoted "$VAR" */ output->has_quoted_part = 1; debug_printf_expand("quoted '%s', output->o_escape:%d\n", val, @@ -7129,6 +7135,8 @@ static NOINLINE int expand_vars_to_list(o_string *output, int n, char *arg) debug_printf_subst("SUBST RES:%d '%s'\n", G.last_exitcode, subst_result.data); n = append_str_maybe_ifs_split(output, n, first_ch, subst_result.data); o_free(&subst_result); + if (n < 0) + return n; break; } #endif @@ -7215,6 +7223,8 @@ static char **expand_variables(char **argv, unsigned expflags) /* expand argv[i] */ n = expand_vars_to_list(&output, n, *argv++); + if (n < 0) + return NULL; /* if (!output->has_empty_slot) -- need this?? */ o_addchr(&output, '\0'); } @@ -7605,7 +7615,9 @@ static void parse_and_run_stream(struct in_str *inp, int end_trigger) } debug_print_tree(pipe_list, 0); debug_printf_exec("parse_and_run_stream: run_and_free_list\n"); - run_and_free_list(pipe_list); + if (run_and_free_list(pipe_list) < 0) + syntax_error_unexpected_ch(EOF); + empty = 0; if (G_flag_return_in_progress == 1) break; @@ -9897,6 +9909,9 @@ static int run_list(struct pipe *pi) /* create list of variable values */ debug_print_strings("for_list made from", vals); for_list = expand_strvec_to_strvec(vals); + if (for_list == NULL) + return -1; + for_lcur = for_list; debug_print_strings("for_list", for_list); } -- 2.43.0 From jasonpena at awkless.com Mon Feb 12 18:18:37 2024 From: jasonpena at awkless.com (Jason Pena) Date: Mon, 12 Feb 2024 11:18:37 -0700 Subject: Anyone working on implementing ':r! cmd' for vi applet Message-ID: Hello, I am wondering if anyone is currently working on implementing the ':r! cmd' colon command for the vi applet? If no one is working on this, then I have work-in-progress patch that attempts to implement ':r! cmd' by modifing "read" in colon() to use popen() to open a pipe to process the shell command, and fgets() to get the output of the shell command to be read into the current edit buffer using string_insert(). From jasonpena at awkless.com Mon Feb 12 18:34:17 2024 From: jasonpena at awkless.com (Jason Pena) Date: Mon, 12 Feb 2024 11:34:17 -0700 Subject: Anyone working on implementing ':r! cmd' for the vi applet? Message-ID: Hello, is anyone currently working on implementing ':r! cmd' for the vi applet? If not, then I have a simple plan to implement ':r! cmd' with some basic work-in-progress code. In general, by altering "read" in colon() to use popen() to open a pipe to process the shell command. Then use fgets() to get the output of the shell command to a buffer that can then be inserted into the current edit buffer using string_insert(). I think the only real issue is deciding whether or not to use a new flag to determine when the user chooses to use ':r file' instead of ':r! cmd'. The "useforce" flag would not make a lot of semantic sense. Hence, why the test code I have uses a new variable called "variant" to distinguish between ':r file' and ':r! cmd'. All in all, let me know if anyone is already doing this, or to convert my work-in-progress code into a full feature patch submission. From rep.dot.nop at gmail.com Tue Feb 13 18:16:35 2024 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Tue, 13 Feb 2024 19:16:35 +0100 Subject: fix large PID overflow their column in top command In-Reply-To: References: <4458638ee54e4ae7a47a9586de9b874d@AcuMS.aculab.com> Message-ID: <20240213191635.624115f4@nbbrfq.loc> On Mon, 5 Feb 2024 09:56:20 +0000 Matthew Chae wrote: > Hi David, > > I'm sending an improved patch based on your comments. > > Not only does it not care about the PID_MAX value, > it searches all the contents to be output to recognize the required column width > and dynamically allocates the space for PID and PPID appropriately without creating a lot of empty space. > > Additionally, this patch still allows user names to be displayed up to 8 characters without truncation. > > Can you look through the attachment? Unfortunately the patch does not apply to current master. How much would your patch add to the size? Can you bring it down to a minimum? See make baseline; apply the patch;make bloatcheck thanks > (0002-Allocate-PID-PPID-space-dynamically-in-top-command.patch) > > BR-Matthew Chae > ________________________________ > From: David Laight > Sent: Thursday, November 23, 2023 6:10 PM > To: 'Denys Vlasenko' ; Matthew Chae > Cc: busybox at busybox.net ; Christopher Wong > Subject: RE: fix large PID overflow their column in top command > > ... > > + fp = xfopen_for_read("/proc/sys/kernel/pid_max"); > > + if (!fgets(pid_buf, PID_DIGITS_MAX + 1, fp)) { > > ... > > + if (strncmp(pid_buf, "32768", 5) == 0) > > + pid_digits_num = 5; > > + else > > + pid_digits_num = PID_DIGITS_MAX; > > > > The logic above is not sound. Even if sysctl kernel.pid_max > > is 32768, there can be already running processes with pids > 99999. > > It's also probably wrong for pretty much all other values. > > I'd just base the column width on strlen(pid_buf) with a minimum > value of 5. > > It is unlikely that pid_max has been reduced - so column overflow > it that case probably doesn't really matter. > > The more interesting case is really a system with a very large pid_max > that has never run many processes. > You don't really want lots of blank space. > > I can't remember whether top reads everything before doing any output? > Since the output is sorted it probably almost always does. > In which case it knows the column width it will need. > > I did post a patch a while back that enabled 'Irix mode'. > (100% cpu is one cpu at 100%, not all cpus at 100%) > Maybe I should dig it out again. > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales) From Matthew.Chae at axis.com Wed Feb 14 14:05:15 2024 From: Matthew.Chae at axis.com (Matthew Chae) Date: Wed, 14 Feb 2024 14:05:15 +0000 Subject: fix large PID overflow their column in top command In-Reply-To: <20240213191635.624115f4@nbbrfq.loc> References: <4458638ee54e4ae7a47a9586de9b874d@AcuMS.aculab.com> <20240213191635.624115f4@nbbrfq.loc> Message-ID: Hi Bernhard, I'm sending new patch and the result of bloatcheck. Can you review these and give me your thoughts? Just let me know if you think that the code size needs to be reduced. Br-Matthew ________________________________ From: Bernhard Reutner-Fischer Sent: Tuesday, February 13, 2024 7:16 PM To: Matthew Chae Cc: rep.dot.nop at gmail.com ; David Laight ; 'Denys Vlasenko' ; busybox at busybox.net ; Christopher Wong Subject: Re: fix large PID overflow their column in top command On Mon, 5 Feb 2024 09:56:20 +0000 Matthew Chae wrote: > Hi David, > > I'm sending an improved patch based on your comments. > > Not only does it not care about the PID_MAX value, > it searches all the contents to be output to recognize the required column width > and dynamically allocates the space for PID and PPID appropriately without creating a lot of empty space. > > Additionally, this patch still allows user names to be displayed up to 8 characters without truncation. > > Can you look through the attachment? Unfortunately the patch does not apply to current master. How much would your patch add to the size? Can you bring it down to a minimum? See make baseline; apply the patch;make bloatcheck thanks > (0002-Allocate-PID-PPID-space-dynamically-in-top-command.patch) > > BR-Matthew Chae > ________________________________ > From: David Laight > Sent: Thursday, November 23, 2023 6:10 PM > To: 'Denys Vlasenko' ; Matthew Chae > Cc: busybox at busybox.net ; Christopher Wong > Subject: RE: fix large PID overflow their column in top command > > ... > > + fp = xfopen_for_read("/proc/sys/kernel/pid_max"); > > + if (!fgets(pid_buf, PID_DIGITS_MAX + 1, fp)) { > > ... > > + if (strncmp(pid_buf, "32768", 5) == 0) > > + pid_digits_num = 5; > > + else > > + pid_digits_num = PID_DIGITS_MAX; > > > > The logic above is not sound. Even if sysctl kernel.pid_max > > is 32768, there can be already running processes with pids > 99999. > > It's also probably wrong for pretty much all other values. > > I'd just base the column width on strlen(pid_buf) with a minimum > value of 5. > > It is unlikely that pid_max has been reduced - so column overflow > it that case probably doesn't really matter. > > The more interesting case is really a system with a very large pid_max > that has never run many processes. > You don't really want lots of blank space. > > I can't remember whether top reads everything before doing any output? > Since the output is sorted it probably almost always does. > In which case it knows the column width it will need. > > I did post a patch a while back that enabled 'Irix mode'. > (100% cpu is one cpu at 100%, not all cpus at 100%) > Maybe I should dig it out again. > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: bloatcheck_top Type: application/octet-stream Size: 1643 bytes Desc: bloatcheck_top URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-Allocate-PID-PPID-space-dynamically-in-top-command.patch Type: text/x-patch Size: 4493 bytes Desc: 0003-Allocate-PID-PPID-space-dynamically-in-top-command.patch URL: From alexander.wilhelm at westermo.com Wed Feb 14 15:56:32 2024 From: alexander.wilhelm at westermo.com (Alexander Wilhelm) Date: Wed, 14 Feb 2024 16:56:32 +0100 Subject: udhcpc: throttled down data transmission Message-ID: Hello devs, I'm using 'udhcpc' on my ARM64 platform with the following scenario: I have one 'eth0' interface that has a static ip address and the 'udhcpc' client on the same interface. That leads to low data transmission performace on that interface. I analyzed a code a little and found out, that the 'udhcpc' client has an internal state machine. For the setting of file descriptors to use with polling the tool uses either UDP sockets or RAW sockets. As it seems it uses in it's beginning state (INIT_SELECTING) the LISTEN_RAW mode. Thus all IPv4 packets are monitored by 'udhcpc' until DHCPOFFER is received which leads to low performace on 'eth0'. Is it a design desicion or a configurable option? How can I change it, if possible? Best regards Alexander Wilhelm From harv at gmx.de Wed Feb 14 18:06:16 2024 From: harv at gmx.de (Harvey) Date: Wed, 14 Feb 2024 19:06:16 +0100 Subject: Failing shell code under busybox 1.36.1 that worked with 1.31.1 Message-ID: Hello, I am part of the team of a small router distribution called fli4l: https://www.fli4l.de/doku.php?id=start. We use buildroot to generate our images. Due to a hardware crash and the leaving of our main developer we are facing the dead of our project. But there are still some people left and at least we want to try to keep it alive ? That said - the first we have to try is the update of our buildroot base. A lot of work is already done and but we struggle with the busybox update, especially with the ash shell contained. When updating to Version 1.36.1 we are facing script failures in places that did work until busybox 1.31.1. I have tried to debug the code and it seems that the error is contained in a helper include for string handling. The code is: ------------------------------------------------------------------------ # Packs arguments into a single string. # # Input: # $1 = name of variable receiving the arguments in such a way that # (re)evaluating them provides the original arguments # $2... = arguments # Example: # func() { # local args # pack_args args "$@" # send_rpc func_impl "$args" # } # # (in another process) # receive_rpc() { # local func="$1" # local args="$2" # eval $func "$args" # } pack_args() { local _p _resvar=$1 _result= _value shift for _p do _result="$_result '${_p//'/'\"'\"'}''" done eval $_resvar=\${_result\# } } ------------------------------------------------------------------------ The debug trace (using set -x) in V1.31.1 looks like this: + pack_args exit_trap_0 sync_unlock_all_resources + local _p '_resvar=exit_trap_0' '_result=' _value + shift + _result=' '"'"'sync_unlock_all_resources'"'" + eval 'exit_trap_0=${_result#' '}' + exit_trap_0=''"'"'sync_unlock_all_resources'"'" + exit_trap_num=1 + return 0 ------------------------------------------------------------------------ while in V1.36.1 it looks like this: + pack_args exit_trap_0 sync_unlock_all_resources + local _p '_resvar=exit_trap_0' '_result=' _value + shift + _result=' '"'"'sync_unlock_all_resources' ^^^^ missing quote + eval 'exit_trap_0=${_result#' '}' + exit_trap_0=''"'"'sync_unlock_all_resources' ^^^^ missing quote + exit_trap_num=1 + return 0 The eval line then fails with 'Unterminated quoted string' Unfortunately I can't tell where the difference lies. I hope someone can help or at least point me in the right direction. Greetings Harvey From harv at gmx.de Wed Feb 14 18:18:09 2024 From: harv at gmx.de (Harvey) Date: Wed, 14 Feb 2024 19:18:09 +0100 Subject: Failing shell code under busybox 1.36.1 that worked with 1.31.1 In-Reply-To: References: Message-ID: <031f00da-4016-4311-b397-1c04e373d521@gmx.de> Sorry, posted the wrong version of the pack_args() funtion: I have payed with possible solutions for so long that I forgot the restore the original before posting -blush- Here is the original version: ------------------------------------------------------------------------ # Packs arguments into a single string. # # Input: # $1 = name of variable receiving the arguments in such a way that # (re)evaluating them provides the original arguments # $2... = arguments # Example: # func() { # local args # pack_args args "$@" # send_rpc func_impl "$args" # } # # (in another process) # receive_rpc() { # local func="$1" # local args="$2" # eval $func "$args" # } pack_args() { local _p _resvar=$1 _result= _value shift for _p do _result="$_result '${_p//'/'\"'\"'}'" done eval $_resvar=\${_result\# } } ------------------------------------------------------------------------ Harvey Am 14.02.24 um 19:06 schrieb Harvey: > Hello, > > I am part of the team of a small router distribution called fli4l: > https://www.fli4l.de/doku.php?id=start. > > We use buildroot to generate our images. Due to a hardware crash and the > leaving of our main developer we are facing the dead of our project. But > there are still some people left and at least we want to try to keep it > alive ? > > That said - the first we have to try is the update of our buildroot > base. A lot of work is already done and but we struggle with the busybox > update, especially with the ash shell contained. When updating to > Version 1.36.1 we are facing script failures in places that did work > until busybox 1.31.1. > > I have tried to debug the code and it seems that the error is contained > in a helper include for string handling. > > The code is: > ------------------------------------------------------------------------ > # Packs arguments into a single string. > # > # Input: > #?? $1 = name of variable receiving the arguments in such a way that > #??????? (re)evaluating them provides the original arguments > #?? $2... = arguments > # Example: > #?? func() { > #???? local args > #???? pack_args args "$@" > #???? send_rpc func_impl "$args" > #?? } > #?? # (in another process) > #?? receive_rpc() { > #???? local func="$1" > #???? local args="$2" > #???? eval $func "$args" > #?? } > pack_args() > { > ??? local _p _resvar=$1 _result= _value > ??? shift > ??? for _p > ??? do > ??????? _result="$_result '${_p//'/'\"'\"'}''" > ??? done > ??? eval $_resvar=\${_result\# } > } > ------------------------------------------------------------------------ > > The debug trace (using set -x) in V1.31.1 looks like this: > > + pack_args exit_trap_0 sync_unlock_all_resources > + local _p '_resvar=exit_trap_0' '_result=' _value > + shift > + _result=' '"'"'sync_unlock_all_resources'"'" > + eval 'exit_trap_0=${_result#' '}' > + exit_trap_0=''"'"'sync_unlock_all_resources'"'" > + exit_trap_num=1 > + return 0 > > ------------------------------------------------------------------------ > while in V1.36.1 it looks like this: > > + pack_args exit_trap_0 sync_unlock_all_resources > + local _p '_resvar=exit_trap_0' '_result=' _value > + shift > + _result=' '"'"'sync_unlock_all_resources' > ????????????????????????????????????????? ^^^^ missing quote > + eval 'exit_trap_0=${_result#' '}' > + exit_trap_0=''"'"'sync_unlock_all_resources' > ???????????????????????????????????????????? ^^^^ missing quote > + exit_trap_num=1 > + return 0 > > The eval line then fails with 'Unterminated quoted string' > > Unfortunately I can't tell where the difference lies. > > I hope someone can help or at least point me in the right direction. > > Greetings > Harvey > _______________________________________________ > busybox mailing list > busybox at busybox.net > http://lists.busybox.net/mailman/listinfo/busybox From steffen at sdaoden.eu Wed Feb 14 20:03:02 2024 From: steffen at sdaoden.eu (Steffen Nurpmeso) Date: Wed, 14 Feb 2024 21:03:02 +0100 Subject: Failing shell code under busybox 1.36.1 that worked with 1.31.1 In-Reply-To: <031f00da-4016-4311-b397-1c04e373d521@gmx.de> References: <031f00da-4016-4311-b397-1c04e373d521@gmx.de> Message-ID: <20240214200302.3h0NKFvz@steffen%sdaoden.eu> Hello. Harvey wrote in <031f00da-4016-4311-b397-1c04e373d521 at gmx.de>: |Sorry, posted the wrong version of the pack_args() funtion: |I have payed with possible solutions for so long that I forgot the |restore the original before posting -blush- | |Here is the original version: |------------------------------------------------------------------------ | |# Packs arguments into a single string. |# |# Input: |# $1 = name of variable receiving the arguments in such a way that |# (re)evaluating them provides the original arguments |# $2... = arguments Dunno about yours, but Robert Elz (kre) did such in a way that is portable to any shell i tried it with (// is definitely not portable); with only slight changes of mine, as attached. |# Example: |# func() { |# local args |# pack_args args "$@" |# send_rpc func_impl "$args" |# } |# # (in another process) |# receive_rpc() { |# local func="$1" |# local args="$2" |# eval $func "$args" |# } |pack_args() |{ | local _p _resvar=$1 _result= _value | shift | for _p | do | _result="$_result '${_p//'/'\"'\"'}'" | done | eval $_resvar=\${_result\# } |} --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt) -------------- next part -------------- A non-text attachment was scrubbed... Name: quote-rndtrip.sh Type: text/x-shellscript Size: 1341 bytes Desc: not available URL: From steffen at sdaoden.eu Wed Feb 14 20:18:18 2024 From: steffen at sdaoden.eu (Steffen Nurpmeso) Date: Wed, 14 Feb 2024 21:18:18 +0100 Subject: Good joke (Was: Re: [MailServer Notification]Attachment Blocking Notification) In-Reply-To: <27769766AF8F4611A87C44993387EA1A@ARRS.ARRISI.com> References: <27769766AF8F4611A87C44993387EA1A@ARRS.ARRISI.com> Message-ID: <20240214201818.4qvNR-Zy@steffen%sdaoden.eu> Administrator wrote in <27769766AF8F4611A87C44993387EA1A at ARRS.ARRISI.com>: |The quote-rndtrip.sh has been blocked since it violated the Microsoft |Exchange attachment policy and Delete entire message has been taken on |2/14/2024 3:12:02 PM. |If you have any questions, please contact ARRIS IT. Thank you | |Message details: |Server: ATLEXOWA3 |Found in: SMTP |Sender: steffen at sdaoden.eu; |Recipient: harv at gmx.de;busybox at busybox.net; |Subject: Re: Failing shell code under busybox 1.36.1 that worked with |1.31.1 |Attachment name: quote-rndtrip.sh --End of <27769766AF8F4611A87C44993387EA1A at ARRS.ARRISI.com> I almost laughed. Then inline. And good-bye. #!/bin/sh - #@ Round trip quote strings in POSIX shell. For example #@ set -- x 'a \ b' "foo'" "\\'b\\a\\r\\" A? #@ printf "%s: <%s><%s><%s><%s><%s>\n" "$#" "${1}" "${2}" "${3}" "$4" "$5" #@ saved_parameters=`quote_rndtrip "$@"` #@ eval "set -- $saved_parameters" #@ printf "%s: <%s><%s><%s><%s><%s>\n" "$#" "${1}" "${2}" "${3}" "$4" "$5" # # 2017 Robert Elz (kre). # 2017 - 2022 Steffen Nurpmeso . # Public Domain # Though slower use a subshell version instead of properly restoring $IFS # and flags, as elder shells may not be able to properly restore flags via # "set +o" as later standardized in POSIX, and it seems overkill to handle # all possible forms of output "set +o" may or may not actually generate. quote__rndtrip() ( case "$1" in *\'*) ;; *) printf "'%s'" "$1"; return 0;; esac a="$1" s= e= while case "$a" in \'*) a=${a#?}; s="${s}\\\\'";; *\') a=${a%?}; e="${e}\\\\'";; '') printf "${s}${e}"; exit 0;; *) false;; esac do continue done IFS=\' set -f set -- $a r="${1}" shift for a do r="${r}'\\''${a}" done printf "${s}'%s'${e}" "${r}" exit 0 ) quote_rndtrip() ( j= for i do [ -n "$j" ] && printf ' ' j=' ' quote__rndtrip "$i" done ) quote_string() ( j= for i do [ -n "$j" ] && printf '\\ ' j=' ' quote__rndtrip "$i" done ) # s-sht-mode --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt) From d+busybox at adaptive-enterprises.com Thu Feb 15 08:45:44 2024 From: d+busybox at adaptive-enterprises.com (David Leonard) Date: Thu, 15 Feb 2024 18:45:44 +1000 (AEST) Subject: Failing shell code under busybox 1.36.1 that worked with 1.31.1 In-Reply-To: <031f00da-4016-4311-b397-1c04e373d521@gmx.de> References: <031f00da-4016-4311-b397-1c04e373d521@gmx.de> Message-ID: > _result="$_result '${_p//'/'\"'\"'}'" Busybox ash has a CONFIG_ASH_BASH_COMPAT config to get this ${var//...} replacement behaviour. And, in bash, the ' in the pattern section is treated as a quote start. To give the ' a literal meaning, use \' eg ${_p//\'/..repl..} In current busybox ash you will run into a bug where quotes aren't handled in the pattern, and even loses the rest of the word, as you observed. That is, given this script: var="don't g/o" echo "${var/'/'o}!" echo "${var/\'/\'o}!" bash outputs: don't g! (pattern="/o" repl="") don'ot g/o! (pattern="'", repl="'o") and busybox ash outputs: don't g/o (pattern=?, repl=?, NOTE: lost !) don'ot g/o! (pattern="'", repl="'o") Here's a patch to make ash a little bit closer to bash. --- a/shell/ash.c +++ b/shell/ash.c @@ -7058,6 +7058,7 @@ subevalvar(char *start, char *str, int strloc, */ repl = NULL; if (subtype == VSREPLACE || subtype == VSREPLACEALL) { + int quoted = 0; /* Find '/' and replace with NUL */ repl = start; /* The pattern can't be empty. @@ -7073,6 +7074,11 @@ subevalvar(char *start, char *str, int strloc, repl = NULL; break; } + /* Handle quoted patterns */ + if ((unsigned char)*repl == CTLQUOTEMARK) + quoted ^= 1; + if (quoted) + goto literal; if (*repl == '/') { *repl = '\0'; break; @@ -7084,6 +7090,7 @@ subevalvar(char *start, char *str, int strloc, /* Handle escaped slashes, e.g. "${v/\//_}" (they are CTLESC'ed by this point) */ if ((unsigned char)*repl == CTLESC && repl[1]) repl++; + literal: repl++; } } new file mode 100644 index 000000000..23aecb5ae --- /dev/null +++ b/shell/ash_test/ash-vars/var_bash_repl_quoted.right @@ -0,0 +1,3 @@ +ab. +axb. +x/b. new file mode 100644 index 000000000..d2ba39578 --- /dev/null +++ b/shell/ash_test/ash-vars/var_bash_repl_quoted.tests @@ -0,0 +1,4 @@ +v=a/b +echo "${v/'/'}." +echo "${v/'/'/x}." +echo "${v/'a'/x}." On Wed, 14 Feb 2024, Harvey wrote: > Sorry, posted the wrong version of the pack_args() funtion: > I have payed with possible solutions for so long that I forgot the > restore the original before posting -blush- > > Here is the original version: > ------------------------------------------------------------------------ > > # Packs arguments into a single string. > # > # Input: > # $1 = name of variable receiving the arguments in such a way that > # (re)evaluating them provides the original arguments > # $2... = arguments > # Example: > # func() { > # local args > # pack_args args "$@" > # send_rpc func_impl "$args" > # } > # # (in another process) > # receive_rpc() { > # local func="$1" > # local args="$2" > # eval $func "$args" > # } > pack_args() > { > local _p _resvar=$1 _result= _value > shift > for _p > do > _result="$_result '${_p//'/'\"'\"'}'" > done > eval $_resvar=\${_result\# } > } > ------------------------------------------------------------------------ > > Harvey > > Am 14.02.24 um 19:06 schrieb Harvey: >> Hello, >> >> I am part of the team of a small router distribution called fli4l: >> https://www.fli4l.de/doku.php?id=start. >> >> We use buildroot to generate our images. Due to a hardware crash and the >> leaving of our main developer we are facing the dead of our project. But >> there are still some people left and at least we want to try to keep it >> alive ? >> >> That said - the first we have to try is the update of our buildroot >> base. A lot of work is already done and but we struggle with the busybox >> update, especially with the ash shell contained. When updating to >> Version 1.36.1 we are facing script failures in places that did work >> until busybox 1.31.1. >> >> I have tried to debug the code and it seems that the error is contained >> in a helper include for string handling. >> >> The code is: >> ------------------------------------------------------------------------ >> # Packs arguments into a single string. >> # >> # Input: >> #?? $1 = name of variable receiving the arguments in such a way that >> #??????? (re)evaluating them provides the original arguments >> #?? $2... = arguments >> # Example: >> #?? func() { >> #???? local args >> #???? pack_args args "$@" >> #???? send_rpc func_impl "$args" >> #?? } >> #?? # (in another process) >> #?? receive_rpc() { >> #???? local func="$1" >> #???? local args="$2" >> #???? eval $func "$args" >> #?? } >> pack_args() >> { >> ??? local _p _resvar=$1 _result= _value >> ??? shift >> ??? for _p >> ??? do >> ??????? _result="$_result '${_p//'/'\"'\"'}''" >> ??? done >> ??? eval $_resvar=\${_result\# } >> } >> ------------------------------------------------------------------------ >> >> The debug trace (using set -x) in V1.31.1 looks like this: >> >> + pack_args exit_trap_0 sync_unlock_all_resources >> + local _p '_resvar=exit_trap_0' '_result=' _value >> + shift >> + _result=' '"'"'sync_unlock_all_resources'"'" >> + eval 'exit_trap_0=${_result#' '}' >> + exit_trap_0=''"'"'sync_unlock_all_resources'"'" >> + exit_trap_num=1 >> + return 0 >> >> ------------------------------------------------------------------------ >> while in V1.36.1 it looks like this: >> >> + pack_args exit_trap_0 sync_unlock_all_resources >> + local _p '_resvar=exit_trap_0' '_result=' _value >> + shift >> + _result=' '"'"'sync_unlock_all_resources' >> ????????????????????????????????????????? ^^^^ missing quote >> + eval 'exit_trap_0=${_result#' '}' >> + exit_trap_0=''"'"'sync_unlock_all_resources' >> ???????????????????????????????????????????? ^^^^ missing quote >> + exit_trap_num=1 >> + return 0 >> >> The eval line then fails with 'Unterminated quoted string' >> >> Unfortunately I can't tell where the difference lies. >> >> I hope someone can help or at least point me in the right direction. >> >> Greetings >> Harvey >> _______________________________________________ >> busybox mailing list >> busybox at busybox.net >> http://lists.busybox.net/mailman/listinfo/busybox > _______________________________________________ > busybox mailing list > busybox at busybox.net > http://lists.busybox.net/mailman/listinfo/busybox > From David.Laight at ACULAB.COM Thu Feb 15 10:20:35 2024 From: David.Laight at ACULAB.COM (David Laight) Date: Thu, 15 Feb 2024 10:20:35 +0000 Subject: Failing shell code under busybox 1.36.1 that worked with 1.31.1 In-Reply-To: <031f00da-4016-4311-b397-1c04e373d521@gmx.de> References: <031f00da-4016-4311-b397-1c04e373d521@gmx.de> Message-ID: <2955313e7aeb428cbb772e2a19473e01@AcuMS.aculab.com> From: Harvey > Sent: 14 February 2024 18:18 > Sorry, posted the wrong version of the pack_args() funtion: > I have payed with possible solutions for so long that I forgot the > restore the original before posting -blush- > > Here is the original version: > ------------------------------------------------------------------------ > > # Packs arguments into a single string. > # > # Input: > # $1 = name of variable receiving the arguments in such a way that > # (re)evaluating them provides the original arguments > # $2... = arguments > # Example: > # func() { > # local args > # pack_args args "$@" > # send_rpc func_impl "$args" > # } > # # (in another process) > # receive_rpc() { > # local func="$1" > # local args="$2" > # eval $func "$args" > # } > pack_args() > { > local _p _resvar=$1 _result= _value > shift > for _p > do > _result="$_result '${_p//'/'\"'\"'}'" > done > eval $_resvar=\${_result\# } > } Try just splitting the quoting of the final ' Just adding "" before it might be enough. Failing that add it on the next line. Probably easier than trying to find the bug in ash. (been there, done that...) David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) From David.Laight at ACULAB.COM Thu Feb 15 12:23:21 2024 From: David.Laight at ACULAB.COM (David Laight) Date: Thu, 15 Feb 2024 12:23:21 +0000 Subject: Failing shell code under busybox 1.36.1 that worked with 1.31.1 In-Reply-To: References: <031f00da-4016-4311-b397-1c04e373d521@gmx.de> Message-ID: <8e95e9588fe14764a0d1369c0398d4b4@AcuMS.aculab.com> From: David Leonard > Sent: 15 February 2024 08:46 > To: Harvey > Cc: busybox at busybox.net > Subject: Re: Failing shell code under busybox 1.36.1 that worked with 1.31.1 > > > > _result="$_result '${_p//'/'\"'\"'}'" > > Busybox ash has a CONFIG_ASH_BASH_COMPAT config to get this ${var//...} > replacement behaviour. And, in bash, the ' in the pattern section is treated > as a quote start. To give the ' a literal meaning, use \' > eg ${_p//\'/..repl..} ... It is probably safer to the quotes into variables. Then the syntax analysis won't get messed up. So something like: sq="'" qsq='"'"'"'"' then "${_p/$sg/$qsq}" is probably ok and maybe more readable. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) From ska-dietlibc at skarnet.org Thu Feb 15 12:23:06 2024 From: ska-dietlibc at skarnet.org (Laurent Bercot) Date: Thu, 15 Feb 2024 12:23:06 +0000 Subject: udhcpc: throttled down data transmission In-Reply-To: References: Message-ID: >I'm using 'udhcpc' on my ARM64 platform with the following scenario: I have one >'eth0' interface that has a static ip address and the 'udhcpc' client on the >same interface. That leads to low data transmission performace on that >interface. Most people use udhcpc when they *don't* have a static IP address on an interface, the point of DHCP being to assign an IP address. In that common use case, it is impossible to use UDP, since IPv4 is not configured yet! Listening on a raw socket is the only option. Your use case is pretty niche, already having IPv4 configured on your interface before you use udhcpc. It's not surprising that udhcpc isn't optimized for it: it's a small client after all. I suppose it could be patched to add an option to use UDP when the interface already has an address, but it would mean effort, and more code in busybox, which is probably not worth the trade-off. -- Laurent From alexander.wilhelm at westermo.com Thu Feb 15 14:45:34 2024 From: alexander.wilhelm at westermo.com (Alexander Wilhelm) Date: Thu, 15 Feb 2024 15:45:34 +0100 Subject: udhcpc: throttled down data transmission In-Reply-To: References: Message-ID: Am Thu, Feb 15, 2024 at 12:23:06PM +0000 schrieb Laurent Bercot: > > I'm using 'udhcpc' on my ARM64 platform with the following scenario: I have one > > 'eth0' interface that has a static ip address and the 'udhcpc' client on the > > same interface. That leads to low data transmission performace on that > > interface. > > Most people use udhcpc when they *don't* have a static IP address on > an interface, the point of DHCP being to assign an IP address. In that > common use case, it is impossible to use UDP, since IPv4 is not > configured yet! Listening on a raw socket is the only option. > > Your use case is pretty niche, already having IPv4 configured on your > interface before you use udhcpc. It's not surprising that udhcpc isn't > optimized for it: it's a small client after all. > > I suppose it could be patched to add an option to use UDP when the > interface already has an address, but it would mean effort, and more code > in busybox, which is probably not worth the trade-off. > > -- > Laurent > Thank you for the clear explanation. I'm going to disable the 'udhcpc' client when the interface 'eth0' has already an static IP address. Best regards Alexander Wilhelm From rep.dot.nop at gmail.com Thu Feb 15 20:46:14 2024 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Thu, 15 Feb 2024 21:46:14 +0100 Subject: fix large PID overflow their column in top command In-Reply-To: References: <4458638ee54e4ae7a47a9586de9b874d@AcuMS.aculab.com> <20240213191635.624115f4@nbbrfq.loc> Message-ID: <20240215214614.0c6047ce@nbbrfq.loc> On Wed, 14 Feb 2024 14:05:15 +0000 Matthew Chae wrote: > Hi Bernhard, > > I'm sending new patch and the result of bloatcheck. Many thanks for the updated patch! function old new delta display_process_list 1406 1765 +359 .rodata 99721 99724 +3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 362/0) Total: 362 bytes text data bss dec hex filename 1009548 16507 1840 1027895 faf37 busybox_old 1009910 16507 1840 1028257 fb0a1 busybox_unstripped I think that's too much. For me this gives +293 bytes, still way too much. Can you please see if it helps to retain the manual formatting of PID PPID USER? PS: procps/top.c: In function ?display_process_list?: procps/top.c:664:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 664 | typedef struct { unsigned quot, rem; } bb_div_t; | ^~~~~~~ so please move your new #define PID_STR block down to right before /* what info of the processes is shown */ In + int lines = (lines_rem - 1); please drop the superfluous braces. It is most likely not smaller to use pid_len = strlen(make_human_readable_str(pid_max,0,0)) than to introduce this private count_digits(), i fear? Maybe we could amortize the addition of count_digits by reusing it elsewhere, as a follow-up. thanks > Can you review these and give me your thoughts? > Just let me know if you think that the code size needs to be reduced. > > Br-Matthew > ________________________________ > From: Bernhard Reutner-Fischer > Sent: Tuesday, February 13, 2024 7:16 PM > To: Matthew Chae > Cc: rep.dot.nop at gmail.com ; David Laight ; 'Denys Vlasenko' ; busybox at busybox.net ; Christopher Wong > Subject: Re: fix large PID overflow their column in top command > > On Mon, 5 Feb 2024 09:56:20 +0000 > Matthew Chae wrote: > > > Hi David, > > > > I'm sending an improved patch based on your comments. > > > > Not only does it not care about the PID_MAX value, > > it searches all the contents to be output to recognize the required column width > > and dynamically allocates the space for PID and PPID appropriately without creating a lot of empty space. > > > > Additionally, this patch still allows user names to be displayed up to 8 characters without truncation. > > > > Can you look through the attachment? > > Unfortunately the patch does not apply to current master. > How much would your patch add to the size? Can you bring it down to a > minimum? > See make baseline; apply the patch;make bloatcheck > > thanks > > > (0002-Allocate-PID-PPID-space-dynamically-in-top-command.patch) > > > > BR-Matthew Chae > > ________________________________ > > From: David Laight > > Sent: Thursday, November 23, 2023 6:10 PM > > To: 'Denys Vlasenko' ; Matthew Chae > > Cc: busybox at busybox.net ; Christopher Wong > > Subject: RE: fix large PID overflow their column in top command > > > > ... > > > + fp = xfopen_for_read("/proc/sys/kernel/pid_max"); > > > + if (!fgets(pid_buf, PID_DIGITS_MAX + 1, fp)) { > > > ... > > > + if (strncmp(pid_buf, "32768", 5) == 0) > > > + pid_digits_num = 5; > > > + else > > > + pid_digits_num = PID_DIGITS_MAX; > > > > > > The logic above is not sound. Even if sysctl kernel.pid_max > > > is 32768, there can be already running processes with pids > 99999. > > > > It's also probably wrong for pretty much all other values. > > > > I'd just base the column width on strlen(pid_buf) with a minimum > > value of 5. > > > > It is unlikely that pid_max has been reduced - so column overflow > > it that case probably doesn't really matter. > > > > The more interesting case is really a system with a very large pid_max > > that has never run many processes. > > You don't really want lots of blank space. > > > > I can't remember whether top reads everything before doing any output? > > Since the output is sorted it probably almost always does. > > In which case it knows the column width it will need. > > > > I did post a patch a while back that enabled 'Irix mode'. > > (100% cpu is one cpu at 100%, not all cpus at 100%) > > Maybe I should dig it out again. > > > > David > > > > - > > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > > Registration No: 1397386 (Wales) > From harv at gmx.de Thu Feb 15 21:48:42 2024 From: harv at gmx.de (Harvey) Date: Thu, 15 Feb 2024 22:48:42 +0100 Subject: Failing shell code under busybox 1.36.1 that worked with 1.31.1 In-Reply-To: References: <031f00da-4016-4311-b397-1c04e373d521@gmx.de> Message-ID: David, I can confirm that your patch solves my problem without any further need to change the shell code. Now V 1.36.1 acts in the same way as V 1.31.1 did. Thank you so mutch! Maybe this is candidate to merge ;) Greetings Harvey Am 15.02.24 um 09:45 schrieb David Leonard: > >> ??????? _result="$_result '${_p//'/'\"'\"'}'" > > Busybox ash has a CONFIG_ASH_BASH_COMPAT config to get this ${var//...} > replacement behaviour.? And, in bash, the ' in the pattern section is > treated > as a quote start. To give the ' a literal meaning, use \' > eg ${_p//\'/..repl..} > > In current busybox ash you will run into a bug where quotes aren't > handled in the pattern, and even loses the rest of the word, as you > observed. That is, given this script: > > ????var="don't g/o" > ????echo "${var/'/'o}!" > ????echo "${var/\'/\'o}!" > > bash outputs: > > ????don't g!??????????? (pattern="/o" repl="") > ????don'ot g/o!??????????? (pattern="'", repl="'o") > > and busybox ash outputs: > > ????don't g/o??????????? (pattern=?, repl=?, NOTE: lost !) > ????don'ot g/o!??????????? (pattern="'", repl="'o") > > Here's a patch to make ash a little bit closer to bash. > > --- a/shell/ash.c > +++ b/shell/ash.c > @@ -7058,6 +7058,7 @@ subevalvar(char *start, char *str, int strloc, > ???????? */ > ??????? repl = NULL; > ??????? if (subtype == VSREPLACE || subtype == VSREPLACEALL) { > +?????????????? int quoted = 0; > ??????????????? /* Find '/' and replace with NUL */ > ??????????????? repl = start; > ??????????????? /* The pattern can't be empty. > @@ -7073,6 +7074,11 @@ subevalvar(char *start, char *str, int strloc, > ??????????????????????????????? repl = NULL; > ??????????????????????????????? break; > ??????????????????????? } > +?????????????????????? /* Handle quoted patterns */ > +?????????????????????? if ((unsigned char)*repl == CTLQUOTEMARK) > +?????????????????????????????? quoted ^= 1; > +?????????????????????? if (quoted) > +?????????????????????????????? goto literal; > ??????????????????????? if (*repl == '/') { > ??????????????????????????????? *repl = '\0'; > ??????????????????????????????? break; > @@ -7084,6 +7090,7 @@ subevalvar(char *start, char *str, int strloc, > ??????????????????????? /* Handle escaped slashes, e.g. "${v/\//_}" > (they are CTLESC'ed by this point) */ > ??????????????????????? if ((unsigned char)*repl == CTLESC && repl[1]) > ??????????????????????????????? repl++; > +?????????????? literal: > ??????????????????????? repl++; > ??????????????? } > ??????? } > > new file mode 100644 > index 000000000..23aecb5ae > --- /dev/null > +++ b/shell/ash_test/ash-vars/var_bash_repl_quoted.right > @@ -0,0 +1,3 @@ > +ab. > +axb. > +x/b. > new file mode 100644 > index 000000000..d2ba39578 > --- /dev/null > +++ b/shell/ash_test/ash-vars/var_bash_repl_quoted.tests > @@ -0,0 +1,4 @@ > +v=a/b > +echo "${v/'/'}." > +echo "${v/'/'/x}." > +echo "${v/'a'/x}." > > > > On Wed, 14 Feb 2024, Harvey wrote: > >> Sorry, posted the wrong version of the pack_args() funtion: >> I have payed with possible solutions for so long that I forgot the >> restore the original before posting? -blush- >> >> Here is the original version: >> ------------------------------------------------------------------------ >> >> # Packs arguments into a single string. >> # >> # Input: >> #?? $1 = name of variable receiving the arguments in such a way that >> #??????? (re)evaluating them provides the original arguments >> #?? $2... = arguments >> # Example: >> #?? func() { >> #???? local args >> #???? pack_args args "$@" >> #???? send_rpc func_impl "$args" >> #?? } >> #?? # (in another process) > #?? receive_rpc() { >> #???? local func="$1" >> #???? local args="$2" >> #???? eval $func "$args" >> #?? } >> pack_args() >> { >> ??? local _p _resvar=$1 _result= _value >> ??? shift >> ??? for _p >> ??? do >> ??????? _result="$_result '${_p//'/'\"'\"'}'" >> ??? done >> ??? eval $_resvar=\${_result\# } >> } >> ------------------------------------------------------------------------ >> >> Harvey >> >> Am 14.02.24 um 19:06 schrieb Harvey: >>> Hello, >>> >>> I am part of the team of a small router distribution called fli4l: >>> https://www.fli4l.de/doku.php?id=start. >>> >>> We use buildroot to generate our images. Due to a hardware crash and the >>> leaving of our main developer we are facing the dead of our project. But >>> there are still some people left and at least we want to try to keep it >>> alive ? >>> >>> That said - the first we have to try is the update of our buildroot >>> base. A lot of work is already done and but we struggle with the busybox >>> update, especially with the ash shell contained. When updating to >>> Version 1.36.1 we are facing script failures in places that did work >>> until busybox 1.31.1. >>> >>> I have tried to debug the code and it seems that the error is contained >>> in a helper include for string handling. >>> >>> The code is: >>> ------------------------------------------------------------------------ >>> # Packs arguments into a single string. >>> # >>> # Input: >>> #?? $1 = name of variable receiving the arguments in such a way that >>> #??????? (re)evaluating them provides the original arguments >>> #?? $2... = arguments >>> # Example: >>> #?? func() { >>> #???? local args >>> #???? pack_args args "$@" >>> #???? send_rpc func_impl "$args" >>> #?? } >>> #?? # (in another process) >>> #?? receive_rpc() { >>> #???? local func="$1" >>> #???? local args="$2" >>> #???? eval $func "$args" >>> #?? } >>> pack_args() >>> { >>> ???? local _p _resvar=$1 _result= _value >>> ???? shift >>> ???? for _p >>> ???? do >>> ???????? _result="$_result '${_p//'/'\"'\"'}''" >>> ???? done >>> ???? eval $_resvar=\${_result\# } >>> } >>> ------------------------------------------------------------------------ >>> >>> The debug trace (using set -x) in V1.31.1 looks like this: >>> >>> + pack_args exit_trap_0 sync_unlock_all_resources >>> + local _p '_resvar=exit_trap_0' '_result=' _value >>> + shift >>> + _result=' '"'"'sync_unlock_all_resources'"'" >>> + eval 'exit_trap_0=${_result#' '}' >>> + exit_trap_0=''"'"'sync_unlock_all_resources'"'" >>> + exit_trap_num=1 >>> + return 0 >>> >>> ------------------------------------------------------------------------ >>> while in V1.36.1 it looks like this: >>> >>> + pack_args exit_trap_0 sync_unlock_all_resources >>> + local _p '_resvar=exit_trap_0' '_result=' _value >>> + shift >>> + _result=' '"'"'sync_unlock_all_resources' >>> ?????????????????????????????????????????? ^^^^ missing quote >>> + eval 'exit_trap_0=${_result#' '}' >>> + exit_trap_0=''"'"'sync_unlock_all_resources' >>> ????????????????????????????????????????????? ^^^^ missing quote >>> + exit_trap_num=1 >>> + return 0 >>> >>> The eval line then fails with 'Unterminated quoted string' >>> >>> Unfortunately I can't tell where the difference lies. >>> >>> I hope someone can help or at least point me in the right direction. >>> >>> Greetings >>> Harvey >>> _______________________________________________ >>> busybox mailing list >>> busybox at busybox.net >>> http://lists.busybox.net/mailman/listinfo/busybox >> _______________________________________________ >> busybox mailing list >> busybox at busybox.net >> http://lists.busybox.net/mailman/listinfo/busybox >> From d+busybox at adaptive-enterprises.com Fri Feb 16 03:33:46 2024 From: d+busybox at adaptive-enterprises.com ('David Leonard') Date: Fri, 16 Feb 2024 13:33:46 +1000 (AEST) Subject: Failing shell code under busybox 1.36.1 that worked with 1.31.1 In-Reply-To: <8e95e9588fe14764a0d1369c0398d4b4@AcuMS.aculab.com> References: <031f00da-4016-4311-b397-1c04e373d521@gmx.de> <8e95e9588fe14764a0d1369c0398d4b4@AcuMS.aculab.com> Message-ID: <24523s4q-68q6-o9r8-03o5-3os22rsq2912@nqncgvir-ragrecevfrf.pbz> Well, I also tried adding support for bash's ${var at Q} (which I think is the most readable way to solve quoting) but it seems I really don't understand how ash's subevalvar() works after all :) ./busybox ash -xvc 'v="ab cd"; echo "(${v at Q})"' + v='ab cd' ash: vstransform:str='Q' ash: vstransform:startp='ab cd' + echo ''"'"'a'"'"'ab cd'"'"')' 'a'ab cd') diff --git a/shell/ash.c b/shell/ash.c index ae1b79f37..8d5d6146d 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -222,6 +222,8 @@ #define IF_BASH_PATTERN_SUBST IF_ASH_BASH_COMPAT #define BASH_SUBSTR ENABLE_ASH_BASH_COMPAT #define IF_BASH_SUBSTR IF_ASH_BASH_COMPAT +#define BASH_PARAM_TRANSFORM ENABLE_ASH_BASH_COMPAT +#define IF_BASH_PARAM_TRANSFORM IF_ASH_BASH_COMPAT /* BASH_TEST2: [[ EXPR ]] * Status of [[ support: * && and || work as they should @@ -574,6 +576,7 @@ var_end(const char *var) return var; } +static int hasmeta(const char *); /* ============ Parser data */ @@ -868,6 +871,9 @@ out2str(const char *p) #define VSREPLACE 0xd /* ${var/pattern/replacement} */ #define VSREPLACEALL 0xe /* ${var//pattern/replacement} */ #endif +#if BASH_PARAM_TRANSFORM +#define VSTRANSFORM 0xf /* ${var at operator} */ +#endif static const char dolatstr[] ALIGN1 = { CTLQUOTEMARK, CTLVAR, VSNORMAL, '@', '=', CTLQUOTEMARK, '\0' @@ -7262,6 +7268,20 @@ subevalvar(char *start, char *str, int strloc, repl ? NULL : (slash_pos < 0 ? NULL : &slash_pos) ); +#if BASH_PARAM_TRANSFORM + if (subtype == VSTRANSFORM) { + bb_error_msg("vstransform:str='%s'", str); + if (strcmp(str, "Q") != 0) + goto out1; + bb_error_msg("vstransform:startp='%s'", startp); + char *quoted = single_quote(startp); + int len = strlen(quoted); + memmove(startp, quoted, len); + loc = startp + len; + goto out; + } +#endif /* BASH_PARAM_TRANSFORM */ + #if BASH_PATTERN_SUBST workloc = expdest - (char *)stackblock(); if (subtype == VSREPLACE || subtype == VSREPLACEALL) { @@ -7432,7 +7452,7 @@ subevalvar(char *start, char *str, int strloc, out: amount = loc - expdest; STADJUST(amount, expdest); -#if BASH_PATTERN_SUBST +#if BASH_PATTERN_SUBST || BASH_PARAM_TRANSFORM out1: #endif /* Remove any recorded regions beyond start of variable */ @@ -7671,6 +7691,9 @@ evalvar(char *p, int flag) #if BASH_PATTERN_SUBST case VSREPLACE: case VSREPLACEALL: +#endif +#if BASH_PARAM_TRANSFORM + case VSTRANSFORM: #endif break; default: @@ -12989,6 +13012,13 @@ parsesub: { goto badsub; subtype++; /* VSREPLACEALL */ break; +#endif +#if BASH_PARAM_TRANSFORM + case '@': + /* ${v at operator} */ + subtype = VSTRANSFORM; + newsyn = BASESYNTAX; + break; #endif } } else { On Thu, 15 Feb 2024, David Laight wrote: > From: David Leonard >> Sent: 15 February 2024 08:46 >> To: Harvey >> Cc: busybox at busybox.net >> Subject: Re: Failing shell code under busybox 1.36.1 that worked with 1.31.1 >> >> >>> _result="$_result '${_p//'/'\"'\"'}'" >> >> Busybox ash has a CONFIG_ASH_BASH_COMPAT config to get this ${var//...} >> replacement behaviour. And, in bash, the ' in the pattern section is treated >> as a quote start. To give the ' a literal meaning, use \' >> eg ${_p//\'/..repl..} > ... > > It is probably safer to the quotes into variables. > Then the syntax analysis won't get messed up. > > So something like: > sq="'" > qsq='"'"'"'"' > > then > "${_p/$sg/$qsq}" > > is probably ok and maybe more readable. > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales) > From harv at gmx.de Fri Feb 16 12:28:56 2024 From: harv at gmx.de (Harvey) Date: Fri, 16 Feb 2024 13:28:56 +0100 Subject: Failing shell code under busybox 1.36.1 that worked with 1.31.1 In-Reply-To: References: <031f00da-4016-4311-b397-1c04e373d521@gmx.de> Message-ID: <4ec77e21-54fc-4bf0-8236-0e46b385b450@gmx.de> BTW, do we have to propose this patch somewhere else or is this already the right place? Greetings Harvey Am 15.02.24 um 22:48 schrieb Harvey: > David, > > I can confirm that your patch solves my problem without any further need > to change the shell code. Now V 1.36.1 acts in the same way as V 1.31.1 > did. Thank you so mutch! Maybe this is candidate to merge ;) > > Greetings > Harvey > > Am 15.02.24 um 09:45 schrieb David Leonard: >> >>> ??????? _result="$_result '${_p//'/'\"'\"'}'" >> >> Busybox ash has a CONFIG_ASH_BASH_COMPAT config to get this ${var//...} >> replacement behaviour.? And, in bash, the ' in the pattern section is >> treated >> as a quote start. To give the ' a literal meaning, use \' >> eg ${_p//\'/..repl..} >> >> In current busybox ash you will run into a bug where quotes aren't >> handled in the pattern, and even loses the rest of the word, as you >> observed. That is, given this script: >> >> ?????var="don't g/o" >> ?????echo "${var/'/'o}!" >> ?????echo "${var/\'/\'o}!" >> >> bash outputs: >> >> ?????don't g!??????????? (pattern="/o" repl="") >> ?????don'ot g/o!??????????? (pattern="'", repl="'o") >> >> and busybox ash outputs: >> >> ?????don't g/o??????????? (pattern=?, repl=?, NOTE: lost !) >> ?????don'ot g/o!??????????? (pattern="'", repl="'o") >> >> Here's a patch to make ash a little bit closer to bash. >> >> --- a/shell/ash.c >> +++ b/shell/ash.c >> @@ -7058,6 +7058,7 @@ subevalvar(char *start, char *str, int strloc, >> ????????? */ >> ???????? repl = NULL; >> ???????? if (subtype == VSREPLACE || subtype == VSREPLACEALL) { >> +?????????????? int quoted = 0; >> ???????????????? /* Find '/' and replace with NUL */ >> ???????????????? repl = start; >> ???????????????? /* The pattern can't be empty. >> @@ -7073,6 +7074,11 @@ subevalvar(char *start, char *str, int strloc, >> ???????????????????????????????? repl = NULL; >> ???????????????????????????????? break; >> ???????????????????????? } >> +?????????????????????? /* Handle quoted patterns */ >> +?????????????????????? if ((unsigned char)*repl == CTLQUOTEMARK) >> +?????????????????????????????? quoted ^= 1; >> +?????????????????????? if (quoted) >> +?????????????????????????????? goto literal; >> ???????????????????????? if (*repl == '/') { >> ???????????????????????????????? *repl = '\0'; >> ???????????????????????????????? break; >> @@ -7084,6 +7090,7 @@ subevalvar(char *start, char *str, int strloc, >> ???????????????????????? /* Handle escaped slashes, e.g. "${v/\//_}" >> (they are CTLESC'ed by this point) */ >> ???????????????????????? if ((unsigned char)*repl == CTLESC && repl[1]) >> ???????????????????????????????? repl++; >> +?????????????? literal: >> ???????????????????????? repl++; >> ???????????????? } >> ???????? } >> >> new file mode 100644 >> index 000000000..23aecb5ae >> --- /dev/null >> +++ b/shell/ash_test/ash-vars/var_bash_repl_quoted.right >> @@ -0,0 +1,3 @@ >> +ab. >> +axb. >> +x/b. >> new file mode 100644 >> index 000000000..d2ba39578 >> --- /dev/null >> +++ b/shell/ash_test/ash-vars/var_bash_repl_quoted.tests >> @@ -0,0 +1,4 @@ >> +v=a/b >> +echo "${v/'/'}." >> +echo "${v/'/'/x}." >> +echo "${v/'a'/x}." >> >> >> >> On Wed, 14 Feb 2024, Harvey wrote: >> >>> Sorry, posted the wrong version of the pack_args() funtion: >>> I have payed with possible solutions for so long that I forgot the >>> restore the original before posting? -blush- >>> >>> Here is the original version: >>> ------------------------------------------------------------------------ >>> >>> # Packs arguments into a single string. >>> # >>> # Input: >>> #?? $1 = name of variable receiving the arguments in such a way that >>> #??????? (re)evaluating them provides the original arguments >>> #?? $2... = arguments >>> # Example: >>> #?? func() { >>> #???? local args >>> #???? pack_args args "$@" >>> #???? send_rpc func_impl "$args" >>> #?? } >>> #?? # (in another process) > #?? receive_rpc() { >>> #???? local func="$1" >>> #???? local args="$2" >>> #???? eval $func "$args" >>> #?? } >>> pack_args() >>> { >>> ??? local _p _resvar=$1 _result= _value >>> ??? shift >>> ??? for _p >>> ??? do >>> ??????? _result="$_result '${_p//'/'\"'\"'}'" >>> ??? done >>> ??? eval $_resvar=\${_result\# } >>> } >>> ------------------------------------------------------------------------ >>> >>> Harvey >>> >>> Am 14.02.24 um 19:06 schrieb Harvey: >>>> Hello, >>>> >>>> I am part of the team of a small router distribution called fli4l: >>>> https://www.fli4l.de/doku.php?id=start. >>>> >>>> We use buildroot to generate our images. Due to a hardware crash and >>>> the >>>> leaving of our main developer we are facing the dead of our project. >>>> But >>>> there are still some people left and at least we want to try to keep it >>>> alive ? >>>> >>>> That said - the first we have to try is the update of our buildroot >>>> base. A lot of work is already done and but we struggle with the >>>> busybox >>>> update, especially with the ash shell contained. When updating to >>>> Version 1.36.1 we are facing script failures in places that did work >>>> until busybox 1.31.1. >>>> >>>> I have tried to debug the code and it seems that the error is contained >>>> in a helper include for string handling. >>>> >>>> The code is: >>>> ------------------------------------------------------------------------ >>>> # Packs arguments into a single string. >>>> # >>>> # Input: >>>> #?? $1 = name of variable receiving the arguments in such a way that >>>> #??????? (re)evaluating them provides the original arguments >>>> #?? $2... = arguments >>>> # Example: >>>> #?? func() { >>>> #???? local args >>>> #???? pack_args args "$@" >>>> #???? send_rpc func_impl "$args" >>>> #?? } >>>> #?? # (in another process) >>>> #?? receive_rpc() { >>>> #???? local func="$1" >>>> #???? local args="$2" >>>> #???? eval $func "$args" >>>> #?? } >>>> pack_args() >>>> { >>>> ???? local _p _resvar=$1 _result= _value >>>> ???? shift >>>> ???? for _p >>>> ???? do >>>> ???????? _result="$_result '${_p//'/'\"'\"'}''" >>>> ???? done >>>> ???? eval $_resvar=\${_result\# } >>>> } >>>> ------------------------------------------------------------------------ >>>> >>>> The debug trace (using set -x) in V1.31.1 looks like this: >>>> >>>> + pack_args exit_trap_0 sync_unlock_all_resources >>>> + local _p '_resvar=exit_trap_0' '_result=' _value >>>> + shift >>>> + _result=' '"'"'sync_unlock_all_resources'"'" >>>> + eval 'exit_trap_0=${_result#' '}' >>>> + exit_trap_0=''"'"'sync_unlock_all_resources'"'" >>>> + exit_trap_num=1 >>>> + return 0 >>>> >>>> ------------------------------------------------------------------------ >>>> while in V1.36.1 it looks like this: >>>> >>>> + pack_args exit_trap_0 sync_unlock_all_resources >>>> + local _p '_resvar=exit_trap_0' '_result=' _value >>>> + shift >>>> + _result=' '"'"'sync_unlock_all_resources' >>>> ?????????????????????????????????????????? ^^^^ missing quote >>>> + eval 'exit_trap_0=${_result#' '}' >>>> + exit_trap_0=''"'"'sync_unlock_all_resources' >>>> ????????????????????????????????????????????? ^^^^ missing quote >>>> + exit_trap_num=1 >>>> + return 0 >>>> >>>> The eval line then fails with 'Unterminated quoted string' >>>> >>>> Unfortunately I can't tell where the difference lies. >>>> >>>> I hope someone can help or at least point me in the right direction. >>>> >>>> Greetings >>>> Harvey >>>> _______________________________________________ >>>> busybox mailing list >>>> busybox at busybox.net >>>> http://lists.busybox.net/mailman/listinfo/busybox >>> _______________________________________________ >>> busybox mailing list >>> busybox at busybox.net >>> http://lists.busybox.net/mailman/listinfo/busybox >>> > _______________________________________________ > busybox mailing list > busybox at busybox.net > http://lists.busybox.net/mailman/listinfo/busybox From Matthew.Chae at axis.com Mon Feb 19 10:22:05 2024 From: Matthew.Chae at axis.com (Matthew Chae) Date: Mon, 19 Feb 2024 10:22:05 +0000 Subject: fix large PID overflow their column in top command In-Reply-To: <20240215214614.0c6047ce@nbbrfq.loc> References: <4458638ee54e4ae7a47a9586de9b874d@AcuMS.aculab.com> <20240213191635.624115f4@nbbrfq.loc> <20240215214614.0c6047ce@nbbrfq.loc> Message-ID: Hi Bernhard, I'm sending new patch and the result of bloatcheck. For me, this size is reduced to 135 bytes. What do you think? Can you take a look at these attachments? PS: The function of count_digits() is implemented inside of display_process_list(). To reduce the size, strlen() is not used. Br-Matthew ________________________________ From: Bernhard Reutner-Fischer Sent: Thursday, February 15, 2024 9:46 PM To: Matthew Chae Cc: rep.dot.nop at gmail.com ; David Laight ; 'Denys Vlasenko' ; busybox at busybox.net ; Christopher Wong Subject: Re: fix large PID overflow their column in top command On Wed, 14 Feb 2024 14:05:15 +0000 Matthew Chae wrote: > Hi Bernhard, > > I'm sending new patch and the result of bloatcheck. Many thanks for the updated patch! function old new delta display_process_list 1406 1765 +359 .rodata 99721 99724 +3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 362/0) Total: 362 bytes text data bss dec hex filename 1009548 16507 1840 1027895 faf37 busybox_old 1009910 16507 1840 1028257 fb0a1 busybox_unstripped I think that's too much. For me this gives +293 bytes, still way too much. Can you please see if it helps to retain the manual formatting of PID PPID USER? PS: procps/top.c: In function ?display_process_list?: procps/top.c:664:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 664 | typedef struct { unsigned quot, rem; } bb_div_t; | ^~~~~~~ so please move your new #define PID_STR block down to right before /* what info of the processes is shown */ In + int lines = (lines_rem - 1); please drop the superfluous braces. It is most likely not smaller to use pid_len = strlen(make_human_readable_str(pid_max,0,0)) than to introduce this private count_digits(), i fear? Maybe we could amortize the addition of count_digits by reusing it elsewhere, as a follow-up. thanks > Can you review these and give me your thoughts? > Just let me know if you think that the code size needs to be reduced. > > Br-Matthew > ________________________________ > From: Bernhard Reutner-Fischer > Sent: Tuesday, February 13, 2024 7:16 PM > To: Matthew Chae > Cc: rep.dot.nop at gmail.com ; David Laight ; 'Denys Vlasenko' ; busybox at busybox.net ; Christopher Wong > Subject: Re: fix large PID overflow their column in top command > > On Mon, 5 Feb 2024 09:56:20 +0000 > Matthew Chae wrote: > > > Hi David, > > > > I'm sending an improved patch based on your comments. > > > > Not only does it not care about the PID_MAX value, > > it searches all the contents to be output to recognize the required column width > > and dynamically allocates the space for PID and PPID appropriately without creating a lot of empty space. > > > > Additionally, this patch still allows user names to be displayed up to 8 characters without truncation. > > > > Can you look through the attachment? > > Unfortunately the patch does not apply to current master. > How much would your patch add to the size? Can you bring it down to a > minimum? > See make baseline; apply the patch;make bloatcheck > > thanks > > > (0002-Allocate-PID-PPID-space-dynamically-in-top-command.patch) > > > > BR-Matthew Chae > > ________________________________ > > From: David Laight > > Sent: Thursday, November 23, 2023 6:10 PM > > To: 'Denys Vlasenko' ; Matthew Chae > > Cc: busybox at busybox.net ; Christopher Wong > > Subject: RE: fix large PID overflow their column in top command > > > > ... > > > + fp = xfopen_for_read("/proc/sys/kernel/pid_max"); > > > + if (!fgets(pid_buf, PID_DIGITS_MAX + 1, fp)) { > > > ... > > > + if (strncmp(pid_buf, "32768", 5) == 0) > > > + pid_digits_num = 5; > > > + else > > > + pid_digits_num = PID_DIGITS_MAX; > > > > > > The logic above is not sound. Even if sysctl kernel.pid_max > > > is 32768, there can be already running processes with pids > 99999. > > > > It's also probably wrong for pretty much all other values. > > > > I'd just base the column width on strlen(pid_buf) with a minimum > > value of 5. > > > > It is unlikely that pid_max has been reduced - so column overflow > > it that case probably doesn't really matter. > > > > The more interesting case is really a system with a very large pid_max > > that has never run many processes. > > You don't really want lots of blank space. > > > > I can't remember whether top reads everything before doing any output? > > Since the output is sorted it probably almost always does. > > In which case it knows the column width it will need. > > > > I did post a patch a while back that enabled 'Irix mode'. > > (100% cpu is one cpu at 100%, not all cpus at 100%) > > Maybe I should dig it out again. > > > > David > > > > - > > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > > Registration No: 1397386 (Wales) > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: bloatcheck_top_0004 Type: application/octet-stream Size: 537 bytes Desc: bloatcheck_top_0004 URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-Allocate-PID-PPID-space-dynamically-in-top-command.patch Type: text/x-patch Size: 3863 bytes Desc: 0004-Allocate-PID-PPID-space-dynamically-in-top-command.patch URL: From Matthew.Chae at axis.com Mon Feb 19 14:09:24 2024 From: Matthew.Chae at axis.com (Matthew Chae) Date: Mon, 19 Feb 2024 14:09:24 +0000 Subject: Print full username and groupname for ls command Message-ID: Hi maintainer, Currently, when using ls, only the first 8 characters of the username and group name are printed, with the rest being truncated. However, there are often long usernames and group names, and limiting them to 8 characters can cause confusion and potential security vulnerabilities. Therefore, it would be beneficial to be able to print the full username/group name when using ls. I'm sending the patch I've mentioned for this. Can I hear your opinion? Br-Matthew Chae -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Print-full-username-and-groupname-for-ls-command.patch Type: text/x-patch Size: 2965 bytes Desc: 0001-Print-full-username-and-groupname-for-ls-command.patch URL: From rep.dot.nop at gmail.com Wed Feb 21 20:23:03 2024 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Wed, 21 Feb 2024 21:23:03 +0100 Subject: fix large PID overflow their column in top command In-Reply-To: References: <4458638ee54e4ae7a47a9586de9b874d@AcuMS.aculab.com> <20240213191635.624115f4@nbbrfq.loc> <20240215214614.0c6047ce@nbbrfq.loc> Message-ID: <20240221212303.11038f5e@nbbrfq.loc> Hi Sukyoung! please don't top-post On Mon, 19 Feb 2024 10:22:05 +0000 Matthew Chae wrote: > Hi Bernhard, > > I'm sending new patch and the result of bloatcheck. > For me, this size is reduced to 135 bytes. What do you think? Well, 135b is better than the initial 360b :) > Can you take a look at these attachments? I'd love to. But it doesn't apply, unfortunately: $ git am -s 0004-Allocate-PID-PPID-space-dynamically-in-top-command.patch Applying: Allocate PID/PPID space dynamically in top command error: patch failed: procps/top.c:637 error: procps/top.c: patch does not apply Patch failed at 0001 Allocate PID/PPID space dynamically in top command hint: Use 'git am --show-current-patch=diff' to see the failed patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". $ git am --abort $ patch -p1 -i 0004-Allocate-PID-PPID-space-dynamically-in-top-command.patch patching file procps/top.c Hunk #1 FAILED at 637. Hunk #2 FAILED at 696. Hunk #3 FAILED at 709. 3 out of 3 hunks FAILED -- saving rejects to file procps/top.c.rej So I'd have to manually fiddle the patch to apply, which i honestly don't have time for ATM, as much as i love code-golf in general. Furthermore (and i'm about to update https://busybox.net/developer accordingly), for legal reasons, we require a Signed-off-by, as detailed in https://www.kernel.org/doc/html/latest/process/submitting-patches.html?highlight=sign%20off#sign-your-work-the-developer-s-certificate-of-origin so please check you legal department (which should be fine for axis) and mark your contributions accordingly by 'git commit -s ...' iff this is in line with your legal situation (again, axis legal will most likely understand what this is about without much further ado, AFAIK). > > PS: > The function of count_digits() is implemented inside of display_process_list(). > To reduce the size, strlen() is not used. Did you look if manually outlining count_digits() like you did in the previous version is beneficial? And, did you check my previous question if it is better to use the manual buf "painting", perusing in this case pid_len (for the compile-time constant 6 as it is now) and ppid_len (ditto), and, for your other patch on top, username_len (for the current compile-time constant 8)? The loop to determine the max {,p}pid len is not for free of course, so it's okish if that manifests size-wise. PS: 135b is better than the initial suggestion of ~300b, but given architectures tend to end up with very different codegen per arch and compilers used, i'm always curious which arch and which compiler (version) was used to obtain the alleged results. Guess you target chris with gcc-12-ish? Stating the target arch usually allows us a rough estimate about overall impact on other arches. Many thanks in advance and cheers, Bernhard > > Br-Matthew > > ________________________________ > From: Bernhard Reutner-Fischer > Sent: Thursday, February 15, 2024 9:46 PM > To: Matthew Chae > Cc: rep.dot.nop at gmail.com ; David Laight ; 'Denys Vlasenko' ; busybox at busybox.net ; Christopher Wong > Subject: Re: fix large PID overflow their column in top command > > On Wed, 14 Feb 2024 14:05:15 +0000 > Matthew Chae wrote: > > > Hi Bernhard, > > > > I'm sending new patch and the result of bloatcheck. > > Many thanks for the updated patch! > > function old new delta > display_process_list 1406 1765 +359 > .rodata 99721 99724 +3 > ------------------------------------------------------------------------------ > (add/remove: 0/0 grow/shrink: 2/0 up/down: 362/0) Total: 362 bytes > text data bss dec hex filename > 1009548 16507 1840 1027895 faf37 busybox_old > 1009910 16507 1840 1028257 fb0a1 busybox_unstripped > > I think that's too much. For me this gives +293 bytes, still way too much. > Can you please see if it helps to retain the manual formatting of > PID PPID USER? > > PS: > > procps/top.c: In function ?display_process_list?: > procps/top.c:664:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] > 664 | typedef struct { unsigned quot, rem; } bb_div_t; > | ^~~~~~~ > > so please move your new #define PID_STR block down to right before > /* what info of the processes is shown */ > > In > + int lines = (lines_rem - 1); > please drop the superfluous braces. > > It is most likely not smaller to use > pid_len = strlen(make_human_readable_str(pid_max,0,0)) > than to introduce this private count_digits(), i fear? > Maybe we could amortize the addition of count_digits by > reusing it elsewhere, as a follow-up. > > thanks > > > Can you review these and give me your thoughts? > > Just let me know if you think that the code size needs to be reduced. > > > > Br-Matthew > > ________________________________ > > From: Bernhard Reutner-Fischer > > Sent: Tuesday, February 13, 2024 7:16 PM > > To: Matthew Chae > > Cc: rep.dot.nop at gmail.com ; David Laight ; 'Denys Vlasenko' ; busybox at busybox.net ; Christopher Wong > > Subject: Re: fix large PID overflow their column in top command > > > > On Mon, 5 Feb 2024 09:56:20 +0000 > > Matthew Chae wrote: > > > > > Hi David, > > > > > > I'm sending an improved patch based on your comments. > > > > > > Not only does it not care about the PID_MAX value, > > > it searches all the contents to be output to recognize the required column width > > > and dynamically allocates the space for PID and PPID appropriately without creating a lot of empty space. > > > > > > Additionally, this patch still allows user names to be displayed up to 8 characters without truncation. > > > > > > Can you look through the attachment? > > > > Unfortunately the patch does not apply to current master. > > How much would your patch add to the size? Can you bring it down to a > > minimum? > > See make baseline; apply the patch;make bloatcheck > > > > thanks > > > > > (0002-Allocate-PID-PPID-space-dynamically-in-top-command.patch) > > > > > > BR-Matthew Chae > > > ________________________________ > > > From: David Laight > > > Sent: Thursday, November 23, 2023 6:10 PM > > > To: 'Denys Vlasenko' ; Matthew Chae > > > Cc: busybox at busybox.net ; Christopher Wong > > > Subject: RE: fix large PID overflow their column in top command > > > > > > ... > > > > + fp = xfopen_for_read("/proc/sys/kernel/pid_max"); > > > > + if (!fgets(pid_buf, PID_DIGITS_MAX + 1, fp)) { > > > > ... > > > > + if (strncmp(pid_buf, "32768", 5) == 0) > > > > + pid_digits_num = 5; > > > > + else > > > > + pid_digits_num = PID_DIGITS_MAX; > > > > > > > > The logic above is not sound. Even if sysctl kernel.pid_max > > > > is 32768, there can be already running processes with pids > 99999. > > > > > > It's also probably wrong for pretty much all other values. > > > > > > I'd just base the column width on strlen(pid_buf) with a minimum > > > value of 5. > > > > > > It is unlikely that pid_max has been reduced - so column overflow > > > it that case probably doesn't really matter. > > > > > > The more interesting case is really a system with a very large pid_max > > > that has never run many processes. > > > You don't really want lots of blank space. > > > > > > I can't remember whether top reads everything before doing any output? > > > Since the output is sorted it probably almost always does. > > > In which case it knows the column width it will need. > > > > > > I did post a patch a while back that enabled 'Irix mode'. > > > (100% cpu is one cpu at 100%, not all cpus at 100%) > > > Maybe I should dig it out again. > > > > > > David > > > > > > - > > > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > > > Registration No: 1397386 (Wales) > > > From vda.linux at googlemail.com Sun Feb 25 00:06:15 2024 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Sun, 25 Feb 2024 01:06:15 +0100 Subject: Print full username and groupname for ls command In-Reply-To: References: Message-ID: I think we can simply stop the truncation, like this: - column += printf("%-8.8s %-8.8s ", + column += printf("%-8s %-8s ", without additional loop to measure max length. On Mon, Feb 19, 2024 at 3:09?PM Matthew Chae wrote: > > Hi maintainer, > > Currently, when using ls, only the first 8 characters of the username and group name are printed, with the rest being truncated. However, there are often long usernames and group names, and limiting them to 8 characters can cause confusion and potential security vulnerabilities. Therefore, it would be beneficial to be able to print the full username/group name when using ls. > > I'm sending the patch I've mentioned for this. Can I hear your opinion? > > Br-Matthew Chae > _______________________________________________ > busybox mailing list > busybox at busybox.net > http://lists.busybox.net/mailman/listinfo/busybox From dario.binacchi at amarulasolutions.com Sun Feb 25 09:13:32 2024 From: dario.binacchi at amarulasolutions.com (Dario Binacchi) Date: Sun, 25 Feb 2024 10:13:32 +0100 Subject: [RESEND PATCH 0/1] ip link: support for the CAN netlink Message-ID: <20240225091333.1553331-1-dario.binacchi@amarulasolutions.com> If it can be helpful in deciding whether to consider this patch, or at least receive a review response, here is the link to the talk I gave at FOSDEM 2024: https://fosdem.org/2024/schedule/event/fosdem-2024-2864-linux-can-upstreaming-on-mmu-less-systems/ Dario Binacchi (1): ip link: support for the CAN netlink configs/TEST_nommu_defconfig | 1 + networking/ip.c | 84 ++++++++++ networking/libiproute/iplink.c | 298 ++++++++++++++++++++++++++++++++- 3 files changed, 374 insertions(+), 9 deletions(-) -- 2.43.0 From dario.binacchi at amarulasolutions.com Sun Feb 25 09:13:33 2024 From: dario.binacchi at amarulasolutions.com (Dario Binacchi) Date: Sun, 25 Feb 2024 10:13:33 +0100 Subject: [RESEND PATCH 1/1] ip link: support for the CAN netlink In-Reply-To: <20240225091333.1553331-1-dario.binacchi@amarulasolutions.com> References: <20240225091333.1553331-1-dario.binacchi@amarulasolutions.com> Message-ID: <20240225091333.1553331-2-dario.binacchi@amarulasolutions.com> I developed this application to test the Linux kernel series [1]. As described in it I could not use the iproute2 package since the microcontroller is without MMU. cc: Marc Kleine-Budde [1] https://marc.info/?l=linux-netdev&m=167999323611710&w=2 Signed-off-by: Dario Binacchi --- configs/TEST_nommu_defconfig | 1 + networking/ip.c | 84 ++++++++++ networking/libiproute/iplink.c | 298 ++++++++++++++++++++++++++++++++- 3 files changed, 374 insertions(+), 9 deletions(-) diff --git a/configs/TEST_nommu_defconfig b/configs/TEST_nommu_defconfig index 415f5a8027f9..fa3e9632622a 100644 --- a/configs/TEST_nommu_defconfig +++ b/configs/TEST_nommu_defconfig @@ -703,6 +703,7 @@ CONFIG_FEATURE_INETD_RPC=y CONFIG_IP=y CONFIG_FEATURE_IP_ADDRESS=y CONFIG_FEATURE_IP_LINK=y +CONFIG_FEATURE_IP_LINK_CAN=y CONFIG_FEATURE_IP_ROUTE=y CONFIG_FEATURE_IP_TUNNEL=y CONFIG_FEATURE_IP_RULE=y diff --git a/networking/ip.c b/networking/ip.c index 36126b74738c..e5b704df5b85 100644 --- a/networking/ip.c +++ b/networking/ip.c @@ -32,6 +32,14 @@ //config: help //config: Short form of "ip link" //config: +//config:config IPLINK_CAN +//config: bool "iplink for CAN (4.6 kb)" +//config: default n +//config: depends on IPLINK +//config: select FEATURE_IP_LINK_CAN +//config: help +//config: Short form of "ip link" for CAN +//config: //config:config IPROUTE //config: bool "iproute (15 kb)" //config: default y @@ -74,6 +82,13 @@ //config: help //config: Configure network devices with "ip". //config: +//config:config FEATURE_IP_LINK_CAN +//config: bool "ip link can" +//config: default n +//config: depends on IP_LINK_CAN +//config: help +//config: Configure CAN devices with "ip". +//config: //config:config FEATURE_IP_ROUTE //config: bool "ip route" //config: default y @@ -122,6 +137,7 @@ //applet:IF_IP( APPLET_NOEXEC(ip , ip , BB_DIR_SBIN, BB_SUID_DROP, ip )) //applet:IF_IPADDR( APPLET_NOEXEC(ipaddr , ipaddr , BB_DIR_SBIN, BB_SUID_DROP, ipaddr )) //applet:IF_IPLINK( APPLET_NOEXEC(iplink , iplink , BB_DIR_SBIN, BB_SUID_DROP, iplink )) +//applet:IF_IPLINK_CAN(APPLET_NOEXEC(iplinkcan , iplinkcan , BB_DIR_SBIN, BB_SUID_DROP, iplinkcan)) //applet:IF_IPROUTE( APPLET_NOEXEC(iproute , iproute , BB_DIR_SBIN, BB_SUID_DROP, iproute )) //applet:IF_IPRULE( APPLET_NOEXEC(iprule , iprule , BB_DIR_SBIN, BB_SUID_DROP, iprule )) //applet:IF_IPTUNNEL(APPLET_NOEXEC(iptunnel, iptunnel, BB_DIR_SBIN, BB_SUID_DROP, iptunnel)) @@ -130,6 +146,7 @@ //kbuild:lib-$(CONFIG_IP) += ip.o //kbuild:lib-$(CONFIG_IPADDR) += ip.o //kbuild:lib-$(CONFIG_IPLINK) += ip.o +//kbuild:lib-$(CONFIG_IPLINK_CAN) += ip.o //kbuild:lib-$(CONFIG_IPROUTE) += ip.o //kbuild:lib-$(CONFIG_IPRULE) += ip.o //kbuild:lib-$(CONFIG_IPTUNNEL) += ip.o @@ -149,10 +166,16 @@ //usage: "ipaddr show|flush [dev IFACE] [scope SCOPE] [to PREFIX] [label PATTERN]" //usage: //--------------123456789.123456789.123456789.123456789.123456789.123456789.123456789.123....79 +//usage:#if ENABLE_FEATURE_IP_LINK_CAN +//usage:#define iplink_type_usage "\n [type TYPE ARGS]" +//usage:#else +//usage:#define iplink_type_usage "" +//usage:#endif //usage:#define iplink_trivial_usage //usage: /*Usage:iplink*/"set IFACE [up|down] [arp on|off] [multicast on|off]\n" //usage: " [promisc on|off] [mtu NUM] [name NAME] [qlen NUM] [address MAC]\n" //usage: " [master IFACE | nomaster] [netns PID]" +//usage: IF_FEATURE_IP_LINK(iplink_type_usage) // * short help shows only "set" command, long help continues (with just one "\n") // * and shows all other commands: //usage:#define iplink_full_usage "\n" @@ -207,6 +230,59 @@ // bond_slave | ipvlan | geneve | bridge_slave | vrf } //usage: //--------------123456789.123456789.123456789.123456789.123456789.123456789.123456789.123....79 +//usage:#define iplinkcan_trivial_usage +//usage: /*Usage:iplinkcan*/"set DEVICE type can" +//usage:#define iplinkcan_full_usage "\n\n" +//usage: " [bitrate BITRATE [sample-point SAMPLE-POINT]] |\n" +//usage: " [tq TQ prop-seg PROP_SEG phase-seg1 PHASE-SEG1\n" +//usage: " phase-seg2 PHASE-SEG2 [sjw SJW]]\n" +//usage: "\n" +//usage: " [dbitrate BITRATE [dsample-point SAMPLE-POINT]] |\n" +//usage: " [dtq TQ dprop-seg PROP_SEG dphase-seg1 PHASE-SEG1\n" +//usage: " dphase-seg2 PHASE-SEG2 [dsjw SJW]]\n" +//usage: "\n" +//usage: " [loopback on|off] [listen-only on|off] [triple-sampling on|off]\n" +//usage: " [one-shot on|off] [berr-reporting on|off]\n" +//usage: " [fd on|off] [fd-non-iso on|off] [presume-ack on|off]\n" +//usage: "\n" +//usage: " [restart-ms TIME-MS] [restart]\n" +//usage: "\n" +//usage: " [termination 0..65535]\n" +//usage: +//upstream man ip-link-can: +//Usage: ip link set DEVICE type can +// [ bitrate BITRATE [ sample-point SAMPLE-POINT] ] | +// [ tq TQ prop-seg PROP_SEG phase-seg1 PHASE-SEG1 +// phase-seg2 PHASE-SEG2 [ sjw SJW ] ] +// +// [ dbitrate BITRATE [ dsample-point SAMPLE-POINT] ] | +// [ dtq TQ dprop-seg PROP_SEG dphase-seg1 PHASE-SEG1 +// dphase-seg2 PHASE-SEG2 [ dsjw SJW ] ] +// +// [ loopback { on | off } ] +// [ listen-only { on | off } ] +// [ triple-sampling { on | off } ] +// [ one-shot { on | off } ] +// [ berr-reporting { on | off } ] +// [ fd { on | off } ] +// [ fd-non-iso { on | off } ] +// [ presume-ack { on | off } ] +// +// [ restart-ms TIME-MS ] +// [ restart ] +// +// [ termination { 0..65535 } ] +// +// Where: BITRATE := { 1..1000000 } +// SAMPLE-POINT := { 0.000..0.999 } +// TQ := { NUMBER } +// PROP-SEG := { 1..8 } +// PHASE-SEG1 := { 1..8 } +// PHASE-SEG2 := { 1..8 } +// SJW := { 1..4 } +// RESTART-MS := { 0 | NUMBER } +//usage: +//--------------123456789.123456789.123456789.123456789.123456789.123456789.123456789.123....79 //usage:#define iproute_trivial_usage //usage: "list|flush|add|del|change|append|replace|test ROUTE" //usage:#define iproute_full_usage "\n\n" @@ -327,6 +403,7 @@ typedef int FAST_FUNC (*ip_func_ptr_t)(char**); #if ENABLE_IPADDR \ || ENABLE_IPLINK \ + || ENABLE_IPLINK_CAN \ || ENABLE_IPROUTE \ || ENABLE_IPRULE \ || ENABLE_IPTUNNEL \ @@ -352,6 +429,13 @@ int iplink_main(int argc UNUSED_PARAM, char **argv) return ip_do(do_iplink, argv); } #endif +#if ENABLE_IPLINK_CAN +int iplinkcan_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; +int iplinkcan_main(int argc UNUSED_PARAM, char **argv) +{ + return ip_do(do_iplink, argv); +} +#endif #if ENABLE_IPROUTE int iproute_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int iproute_main(int argc UNUSED_PARAM, char **argv) diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c index 9eb0b4f5f118..c3be54f841dd 100644 --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c @@ -11,10 +11,17 @@ #include #include +#include #include "ip_common.h" /* #include "libbb.h" is inside */ #include "rt_names.h" #include "utils.h" +#if ENABLE_FEATURE_IP_LINK_CAN +#define ENABLE_FEATURE_IP_LINK_IFACE 1 +#else +#define ENABLE_FEATURE_IP_LINK_IFACE 0 +#endif + #undef ETH_P_8021AD #define ETH_P_8021AD 0x88A8 #undef VLAN_FLAG_REORDER_HDR @@ -28,6 +35,11 @@ #undef IFLA_VLAN_PROTOCOL #define IFLA_VLAN_PROTOCOL 5 +#ifndef NLMSG_TAIL +#define NLMSG_TAIL(nmsg) \ + ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len))) +#endif + #ifndef IFLA_LINKINFO # define IFLA_LINKINFO 18 # define IFLA_INFO_KIND 1 @@ -55,6 +67,13 @@ struct ifla_vlan_flags { #define str_on_off "on\0""off\0" +enum { + PARM_on = 0, + PARM_off +}; + +typedef void FAST_FUNC(*ip_type_set_func_ptr_t)(char*, char**); + /* Exits on error */ static int get_ctl_fd(void) { @@ -241,10 +260,261 @@ static void die_must_be_on_off(const char *msg) bb_error_msg_and_die("argument of \"%s\" must be \"on\" or \"off\"", msg); } +#if ENABLE_FEATURE_IP_LINK_CAN +static float FAST_FUNC get_float(char *arg, const char *errmsg) +{ + float ret; + char *ptr; + + if (!arg || !*arg) + invarg_1_to_2(arg, errmsg); /* does not return */ + + ret = strtof(arg, &ptr); + if (!ptr || ptr == arg || *ptr) + invarg_1_to_2(arg, errmsg); /* does not return */ + + return ret; +} + +static void do_set_can(char *dev, char **argv) +{ + struct can_bittiming bt = {}, dbt = {}; + struct can_ctrlmode cm = {}; + char *keyword; + static const char keywords[] ALIGN1 = + "bitrate\0""sample-point\0""tq\0" + "prop-seg\0""phase-seg1\0""phase-seg2\0""sjw\0" + "dbitrate\0""dsample-point\0""dtq\0" + "dprop-seg\0""dphase-seg1\0""dphase-seg2\0""dsjw\0" + "loopback\0""listen-only\0""triple-sampling\0" + "one-shot\0""berr-reporting\0" + "fd\0""fd-non-iso\0""presume-ack\0" + "cc-len8-dlc\0""restart\0""restart-ms\0" + "termination\0"; + enum { ARG_bitrate = 0, ARG_sample_point, ARG_tq, + ARG_prop_seg, ARG_phase_seg1, ARG_phase_seg2, ARG_sjw, + ARG_dbitrate, ARG_dsample_point, ARG_dtq, + ARG_dprop_seg, ARG_dphase_seg1, ARG_dphase_seg2, ARG_dsjw, + ARG_loopback, ARG_listen_only, ARG_triple_sampling, + ARG_one_shot, ARG_berr_reporting, + ARG_fd, ARG_fd_non_iso, ARG_presume_ack, + ARG_cc_len8_dlc, ARG_restart, ARG_restart_ms, + ARG_termination }; + struct rtnl_handle rth; + struct { + struct nlmsghdr n; + struct ifinfomsg i; + char buf[1024]; + } req; + size_t dev_len; + struct rtattr *linkinfo, *data; + smalluint key, param; + + memset(&req, 0, sizeof(req)); + + req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)); + req.n.nlmsg_flags = NLM_F_REQUEST; + req.n.nlmsg_type = RTM_NEWLINK; + req.i.ifi_family = preferred_family; + xrtnl_open(&rth); + req.i.ifi_index = xll_name_to_index(dev); + dev_len = strlen(dev); + if (dev_len < 2 || dev_len > IFNAMSIZ) + invarg_1_to_2(dev, "dev"); + + addattr_l(&req.n, sizeof(req), IFLA_IFNAME, dev, dev_len); + linkinfo = NLMSG_TAIL(&req.n); + addattr_l(&req.n, sizeof(req), IFLA_LINKINFO, NULL, 0); + addattr_l(&req.n, sizeof(req), IFLA_INFO_KIND, (void *)"can", + strlen("can")); + data = NLMSG_TAIL(&req.n); + addattr_l(&req.n, sizeof(req), IFLA_INFO_DATA, NULL, 0); + while (*argv) { + key = index_in_substrings(keywords, *argv); + keyword = *argv; + //printf("%s: key: %d, *argv: %s\n", __func__, key, *argv); + switch (key) { + case ARG_bitrate: + case ARG_tq: + case ARG_prop_seg: + case ARG_phase_seg1: + case ARG_phase_seg2: + case ARG_sjw: { + __u32 *val; + + NEXT_ARG(); + if (key == ARG_bitrate) + val = &bt.bitrate; + else if (key == ARG_tq) + val = &bt.tq; + else if (key == ARG_prop_seg) + val = &bt.prop_seg; + else if (key == ARG_phase_seg1) + val = &bt.phase_seg1; + else if (key == ARG_phase_seg2) + val = &bt.phase_seg2; + else + val = &bt.sjw; + + *val = get_u32(*argv, keyword); + break; + } + case ARG_sample_point: { + float sp; + + NEXT_ARG(); + sp = get_float(*argv, keyword); + bt.sample_point = (__u32)(sp * 1000); + break; + } + case ARG_dbitrate: + case ARG_dtq: + case ARG_dprop_seg: + case ARG_dphase_seg1: + case ARG_dphase_seg2: + case ARG_dsjw: { + __u32 *val; + + NEXT_ARG(); + if (key == ARG_dbitrate) + val = &dbt.bitrate; + else if (key == ARG_dtq) + val = &dbt.tq; + else if (key == ARG_dprop_seg) + val = &dbt.prop_seg; + else if (key == ARG_dphase_seg1) + val = &dbt.phase_seg1; + else if (key == ARG_dphase_seg2) + val = &dbt.phase_seg2; + else + val = &dbt.sjw; + + *val = get_u32(*argv, keyword); + break; + } + case ARG_dsample_point: { + float sp; + + NEXT_ARG(); + sp = get_float(*argv, keyword); + dbt.sample_point = (__u32)(sp * 1000); + break; + } + case ARG_loopback: + case ARG_listen_only: + case ARG_triple_sampling: + case ARG_one_shot: + case ARG_berr_reporting: + case ARG_fd: + case ARG_fd_non_iso: + case ARG_presume_ack: + case ARG_cc_len8_dlc: { + __u32 flag = 0; + + NEXT_ARG(); + param = index_in_strings(str_on_off, *argv); + if (param < 0) + die_must_be_on_off(keyword); + + if (key == ARG_loopback) + flag = CAN_CTRLMODE_LOOPBACK; + else if (key == ARG_listen_only) + flag = CAN_CTRLMODE_LISTENONLY; + else if (key == ARG_triple_sampling) + flag = CAN_CTRLMODE_3_SAMPLES; + else if (key == ARG_one_shot) + flag = CAN_CTRLMODE_ONE_SHOT; + else if (key == ARG_berr_reporting) + flag = CAN_CTRLMODE_BERR_REPORTING; + else if (key == ARG_fd) + flag = CAN_CTRLMODE_FD; + else if (key == ARG_fd_non_iso) + flag = CAN_CTRLMODE_FD_NON_ISO; + else if (key == ARG_presume_ack) + flag = CAN_CTRLMODE_PRESUME_ACK; + else +#if defined(CAN_CTRLMODE_CC_LEN8_DLC) + flag = CAN_CTRLMODE_CC_LEN8_DLC; +#else + die_must_be_on_off(keyword); +#endif + cm.mask |= flag; + if (param == PARM_on) + cm.flags |= flag; + + break; + } + case ARG_restart: { + __u32 val = 1; + + NEXT_ARG(); + addattr_l(&req.n, sizeof(req), IFLA_CAN_RESTART, &val, sizeof(val)); + break; + } + case ARG_restart_ms: { + __u32 val; + + NEXT_ARG(); + val = get_u32(*argv, keyword); + addattr_l(&req.n, sizeof(req), IFLA_CAN_RESTART_MS, &val, sizeof(val)); + break; + } + case ARG_termination: { + __u16 val; + + NEXT_ARG(); + val = get_u16(*argv, keyword); + addattr_l(&req.n, sizeof(req), IFLA_CAN_TERMINATION, &val, sizeof(val)); + break; + } + default: + break; + } + + argv++; + } + + if (bt.bitrate || bt.tq) + addattr_l(&req.n, sizeof(req), IFLA_CAN_BITTIMING, &bt, sizeof(bt)); + + if (cm.mask) + addattr_l(&req.n, sizeof(req), IFLA_CAN_CTRLMODE, &cm, sizeof(cm)); + + data->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)data; + linkinfo->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)linkinfo; + + if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + xfunc_die(); +} +#endif + +#if ENABLE_FEATURE_IP_LINK_IFACE +static void do_set_iface(char *type, char *dev, char **argv) +{ + static const char keywords[] ALIGN1 = "" + IF_FEATURE_IP_LINK_CAN("can\0") + ; + static const ip_type_set_func_ptr_t funcs[] ALIGN_PTR = { + IF_FEATURE_IP_LINK_CAN(do_set_can,) + }; + ip_type_set_func_ptr_t func; + int key; + + key = index_in_substrings(keywords, type); + if (key < 0) + return; + func = funcs[key]; + func(dev, argv); +} +#endif + /* Return value becomes exitcode. It's okay to not return at all */ static int do_set(char **argv) { char *dev = NULL; +#if ENABLE_FEATURE_IP_LINK_IFACE + char *type = NULL; +#endif uint32_t mask = 0; uint32_t flags = 0; int qlen = -1; @@ -261,18 +531,24 @@ static int do_set(char **argv) "up\0""down\0""name\0""mtu\0""qlen\0""multicast\0" "arp\0""promisc\0""address\0""netns\0" "master\0""nomaster\0" +#if ENABLE_FEATURE_IP_LINK_IFACE + "type\0" +#endif "dev\0" /* must be last */; enum { ARG_up = 0, ARG_down, ARG_name, ARG_mtu, ARG_qlen, ARG_multicast, ARG_arp, ARG_promisc, ARG_addr, ARG_netns, ARG_master, ARG_nomaster, +#if ENABLE_FEATURE_IP_LINK_IFACE + ARG_type, +#endif ARG_dev }; - enum { PARM_on = 0, PARM_off }; smalluint key; while (*argv) { /* substring search ensures that e.g. "addr" and "address" * are both accepted */ key = index_in_substrings(keywords, *argv); + //printf("%s: key: %d, *argv: %s\n", __func__, key, *argv); if (key == ARG_up) { mask |= IFF_UP; flags |= IFF_UP; @@ -304,6 +580,13 @@ static int do_set(char **argv) } else if (key == ARG_netns) { NEXT_ARG(); netns = get_unsigned(*argv, "netns"); +#if ENABLE_FEATURE_IP_LINK_IFACE + } else if (key == ARG_type) { + NEXT_ARG(); + type = *argv; + argv++; + break; +#endif } else if (key >= ARG_dev) { /* ^^^^^^ ">=" here results in "dev IFACE" treated as default */ if (key == ARG_dev) { @@ -311,6 +594,7 @@ static int do_set(char **argv) } if (dev) duparg2("dev", *argv); + dev = *argv; } else { /* "on|off" options */ @@ -496,6 +780,10 @@ static int do_set(char **argv) } if (mask) do_chflags(dev, flags, mask); +#if ENABLE_FEATURE_IP_LINK_IFACE + if (type) + do_set_iface(type, dev, argv); +#endif return 0; } @@ -531,10 +819,6 @@ static void vlan_parse_opt(char **argv, struct nlmsghdr *n, unsigned int size) PROTO_8021Q = 0, PROTO_8021AD, }; - enum { - PARM_on = 0, - PARM_off - }; int arg; uint16_t id, proto; struct ifla_vlan_flags flags = {}; @@ -610,10 +894,6 @@ static void vrf_parse_opt(char **argv, struct nlmsghdr *n, unsigned int size) addattr_l(n, size, IFLA_VRF_TABLE, &table, sizeof(table)); } -#ifndef NLMSG_TAIL -#define NLMSG_TAIL(nmsg) \ - ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len))) -#endif /* Return value becomes exitcode. It's okay to not return at all */ static int do_add_or_delete(char **argv, const unsigned rtm) { -- 2.43.0 From David.Laight at ACULAB.COM Sun Feb 25 14:14:17 2024 From: David.Laight at ACULAB.COM (David Laight) Date: Sun, 25 Feb 2024 14:14:17 +0000 Subject: Print full username and groupname for ls command In-Reply-To: References: Message-ID: <4be2274336d44ba2913aec43c9e5279a@AcuMS.aculab.com> From: Denys Vlasenko > Sent: 25 February 2024 00:06 > > I think we can simply stop the truncation, like this: > > - column += printf("%-8.8s %-8.8s ", > + column += printf("%-8s %-8s ", > > without additional loop to measure max length. That code isn't safe with a standard libc. If printf() actually does a write() for any reason and the write fails then printf() returns -1 not the length. If you want to check for error (eg disk full) then checking the return value of printf() is also fairly pointless. You really need to call fflush() and then ferror(). David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) From vda.linux at googlemail.com Sun Feb 25 14:38:21 2024 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Sun, 25 Feb 2024 15:38:21 +0100 Subject: [PATCH] hush: Prevent segfault at unexpected EOF in script. In-Reply-To: <20240210155139.184908-1-dm.chestnykh@gmail.com> References: <20240210155139.184908-1-dm.chestnykh@gmail.com> Message-ID: On Sat, Feb 10, 2024 at 4:51?PM Dmitry Chestnykh wrote: > See https://bugs.buildroot.org/show_bug.cgi?id=15937 . > With this patch the execution of reproducer script > from bugzilla leads to the following output: > 'hush: syntax error: unexpected EOF' > > Signed-off-by: Dmitry Chestnykh > --- > shell/hush.c | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > > diff --git a/shell/hush.c b/shell/hush.c > index ca01e2b5b..0595ad592 100644 > --- a/shell/hush.c > +++ b/shell/hush.c > @@ -6132,6 +6132,10 @@ static int expand_on_ifs(o_string *output, int n, const char *str) > > if (!*str) /* EOL - do not finalize word */ > break; > + > + if (!G.ifs) > + return -1; > + The bug is that G.ifs is NULL. It was intended to be always non-NULL. Setting it only in run_pipe() is too late: the parsing of first statement already may require IFS splitting. From vda.linux at googlemail.com Mon Feb 26 13:13:27 2024 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Mon, 26 Feb 2024 14:13:27 +0100 Subject: [RESEND PATCH 1/1] ip link: support for the CAN netlink In-Reply-To: <20240225091333.1553331-2-dario.binacchi@amarulasolutions.com> References: <20240225091333.1553331-1-dario.binacchi@amarulasolutions.com> <20240225091333.1553331-2-dario.binacchi@amarulasolutions.com> Message-ID: On Sun, Feb 25, 2024 at 10:13?AM Dario Binacchi wrote: > I developed this application to test the Linux kernel series [1]. As > described in it I could not use the iproute2 package since the > microcontroller is without MMU. I don't think we need to have "iplinkcan" applet. (I'm not sure having the non-standard "iplink" et al was a good idea in the first place) Let's just use "ip link set type can ..." syntax only > + case ARG_restart: { > + __u32 val = 1; > + > + NEXT_ARG(); > + addattr_l(&req.n, sizeof(req), IFLA_CAN_RESTART, &val, sizeof(val)); > + break; > + } Why NEXT_ARG()? "restart" has no parameters, right? I'm applying your patch with some changes. Please try current git. From vda.linux at googlemail.com Mon Feb 26 15:39:40 2024 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Mon, 26 Feb 2024 16:39:40 +0100 Subject: Failing shell code under busybox 1.36.1 that worked with 1.31.1 In-Reply-To: References: <031f00da-4016-4311-b397-1c04e373d521@gmx.de> Message-ID: On Thu, Feb 15, 2024 at 9:52?AM David Leonard wrote: > > _result="$_result '${_p//'/'\"'\"'}'" > > Busybox ash has a CONFIG_ASH_BASH_COMPAT config to get this ${var//...} > replacement behaviour. And, in bash, the ' in the pattern section is treated > as a quote start. To give the ' a literal meaning, use \' > eg ${_p//\'/..repl..} > > In current busybox ash you will run into a bug where quotes aren't > handled in the pattern, and even loses the rest of the word, as you > observed. That is, given this script: > > var="don't g/o" > echo "${var/'/'o}!" > echo "${var/\'/\'o}!" > > bash outputs: > > don't g! (pattern="/o" repl="") > don'ot g/o! (pattern="'", repl="'o") > > and busybox ash outputs: > > don't g/o (pattern=?, repl=?, NOTE: lost !) > don'ot g/o! (pattern="'", repl="'o") > > Here's a patch to make ash a little bit closer to bash. Thank you, applied (with some changes, but the same idea). From patrickrhock at gmail.com Thu Feb 29 01:47:58 2024 From: patrickrhock at gmail.com (Patrick Hock) Date: Wed, 28 Feb 2024 20:47:58 -0500 Subject: Bugs in coreutils/timeout.c for systems without MMU Message-ID: Hi, consider the example prompt for timeout below: timeout -s 9 1 sleep 5 In timeout.c line 120-123: #if !BB_MMU argv[optind] = xasprintf("-p%u", parent); argv[optind + 1] = NULL; #endif This puts a -p:PID argument at the end of the timeout command when it is re-execed, like this example: timeout -s 9 1 -p:577 (Note the lack of a argument after the timeout in seconds (1), this is part of another bug I'll address later.) The issue is that the way options are parsed with getopt32 at the beginning of the program, the '+' makes getopt32 stop parsing when it gets to the first non-option argument (which happens to be the timeout in seconds). This means when timeout is re-execed with the -p option at the end, the -p option is never parsed. This is important because on line 109, the presence of the -p option should make parent true, but it never will. The solution I propose to this is to put the -p option BEFORE the timeout in seconds, essentially swapping the position of the two so that the -p precedes any non option arguments and will be parsed by getopt32 So that would be: #if !BB_MMU argv[optind] = argv[optind - 1] argv[optind - 1] = xasprintf("-p%u", parent); argv[optind + 1] = NULL; #endif Also, when timeout is re-execed with the -p option, you no longer need to pass in an argument for what program needs to be executed. Timeout just needs to kill the process specified by -p after the given timeout. So, on line 98-99: if (!argv[optind]) /* no PROG? */ bb_show_usage(); This should be put after the branch goto grandchild on line 110. Since bb_daemonize_or_rexec redirects output of the re-execed timeout (without a program argument) to /dev/null, you won't see the usage prompt printed to the terminal, but effectively timeout won't work because it's killed prematurely by this. Also, I'm not sure if it is intentional, but this implementation makes it possible to pass a -p:PID argument to timeout in the command line, which makes it kill the specified process ID after the timeout elapses. Patrick H -------------- next part -------------- An HTML attachment was scrubbed... URL: