busybox/libbb
Ron Yorston 298ac9507b lineedit: get PWD from ash
The line editing code and ash disagree when the current directory
is changed to a symbolic link:

   ~ $ mkdir real
   ~ $ ln -s real link
   ~ $ cd link
   ~/real $ pwd
   /home/rmyf36/link

Note the prompt says we're in ~/real.  Bash does:

   [rmy@random ~]$ cd link
   [rmy@random link]$ pwd
   /home/rmyf36/link

Ash uses the name supplied by the user while the line editing code
calls getcwd(3).  The discrepancy can be avoided by fetching the
value of PWD from ash.

Hush calls getcwd(3) when the directory is changed
so there's no disagreement with the line editing code.

There is no standard how shells should handle cd'ing into
symlinks.

function                                             old     new   delta
parse_and_put_prompt                                 838     869     +31

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-07-03 21:41:38 +02:00
..
appletlib.c style fix 2022-05-01 17:06:00 +02:00
ask_confirmation.c xargs: use bb_ask_y_confirmation_FILE() instead of homegrown copy 2018-04-07 15:23:10 +02:00
auto_string.c libbb: auto_string() for efficient handling of temporary malloced stirngs 2015-10-09 17:59:56 +02:00
bb_askpass.c libbb: introduce and use fputs_stdout 2021-02-03 20:52:40 +01:00
bb_bswap_64.c
bb_cat.c fix errors found with make_single_applets.sh 2017-04-12 15:48:19 +02:00
bb_do_delay.c libbb: make msleep() result in only one syscall instead of looping 2020-12-11 16:48:47 +01:00
bb_getgroups.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
bb_getsockname.c libbb: introduce and use bb_getsockname() 2018-02-11 14:55:46 +01:00
bb_pwd.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
bb_qsort.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
bb_strtod.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
bb_strtonum.c printf: fix printf "%u\n" +18446744073709551614 2018-10-30 23:24:18 +01:00
bbunit.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
capability.c decrease paddign: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nilly 2020-11-30 13:03:03 +01:00
change_identity.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
chomp.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
common_bufsiz.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
compare_string_array.c libbb: code shrink and speed up index_in_strings() 2021-02-02 14:37:37 +01:00
concat_path_file.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
concat_subpath_file.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
Config.src libbb/sha1: update config help text with new performance numbers 2022-02-18 17:09:51 +01:00
const_hack.c Make const ptr assign as function call in clang 2021-10-09 22:30:45 +02:00
copy_file.c cp: implement -n 2021-06-22 15:28:34 +02:00
copyfd.c libbb: create and use mmap() helpers 2020-12-14 18:25:28 +01:00
correct_password.c libbb: rename bb_ask -> bb_ask_noecho, bb_ask_confirmation -> bb_ask_y_confirmation 2018-04-07 15:08:12 +02:00
crc32.c libbb: commonalize a bit of little-endian CRC32 table generation code 2018-02-01 10:56:19 +01:00
default_error_retval.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
device_open.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
die_if_bad_username.c Fixes for Hurd build 2020-12-17 11:22:44 +01:00
dump.c *: add NOINLINEs where code noticeably shrinks 2021-10-10 13:50:53 +02:00
duration.c timeout,top,watch,ping: parse NN.N fractional duration in locales with other separators 2021-03-23 13:50:02 +01:00
endofname.c move endofname() to libbb 2013-02-26 00:36:53 +01:00
executable.c libbb: rename run_shell() to exec_shell() 2020-12-02 21:28:47 +01:00
fclose_nonstdin.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
fflush_stdout_and_exit.c libbb: fflush_stdout_and_exit(0) still exits with _error_ (not 0!) if fflush fails 2022-01-04 23:36:16 +01:00
fgets_str.c libbb: code shrink fgets_str 2021-02-03 20:43:07 +01:00
find_mount_point.c libbbb: find_mount_point() too eager to stat mounted devices 2019-04-29 17:59:08 +02:00
find_pid_by_name.c pidof: support "pidof /path/to/binary" case 2019-06-15 18:35:39 +02:00
find_root_device.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
full_write.c dd: fix handling of short result of full_write(), closes 11711 2019-05-14 17:49:14 +02:00
get_console.c *: slap on a few ALIGN* where appropriate 2022-02-06 19:53:10 +01:00
get_cpu_count.c
get_last_path_component.c find: cater for libc w/o FNM_CASEFOLD 2011-05-23 00:40:54 +02:00
get_line_from_file.c libbb: in xmalloc_fgets(), use size_t for bb_get_chunk_from_file() 2018-09-02 18:48:09 +02:00
get_shell_name.c mark get_shell_name FAST_FUNC 2012-10-03 09:42:21 +02:00
get_volsize.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
getopt32.c *: slap on a few ALIGN_PTR where appropriate 2022-02-06 20:07:12 +01:00
getopt_allopts.c getopt32: factor out code to treat all args as options 2017-08-04 16:33:23 +02:00
getpty.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
hash_md5_sha256_x86-32_shaNI.S libbb/sha256: explicitly use sha256rnds2's %xmm0 (MSG) argument 2022-02-12 00:52:12 +01:00
hash_md5_sha256_x86-64_shaNI.S libbb/sha256: explicitly use sha256rnds2's %xmm0 (MSG) argument 2022-02-12 00:52:12 +01:00
hash_md5_sha_x86-32_shaNI.S libbb/sha1: revert last commit: pshufb is a SSSE3 insn, can't use it 2022-02-11 14:53:26 +01:00
hash_md5_sha_x86-64_shaNI.S libbb/sha1: revert last commit: pshufb is a SSSE3 insn, can't use it 2022-02-11 14:53:26 +01:00
hash_md5_sha_x86-64.S whitespace fixes 2022-02-11 23:03:27 +01:00
hash_md5_sha_x86-64.S.sh whitespace fixes 2022-02-11 23:03:27 +01:00
hash_md5_sha.c libbb/sha256: optional x86 hardware accelerated hashing 2022-02-03 14:58:02 +01:00
hash_md5prime.c tls: add 2nd cipher_id, TLS_RSA_WITH_AES_128_CBC_SHA, so far it doesn't work 2017-01-24 16:00:54 +01:00
herror_msg.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
human_readable.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
in_ether.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
inet_cksum.c gcc-9.x warning fixes 2020-10-01 03:07:22 +02:00
inet_common.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
inode_hash.c du: don't count duplicate arguments. Closes 5288 2019-02-19 17:08:39 +01:00
isdirectory.c do not include <sys/stat.h> just before "libbb.h", it's there already 2017-10-05 14:41:36 +02:00
isqrt.c libbb: move isqrt from factor, use it in diff too 2017-04-11 07:34:56 +02:00
iterate_on_dir.c move iterate_on_dir() from e2fsprogs to libbb 2021-06-24 11:42:55 +02:00
Kbuild.src libbb/sha256: optional x86 hardware accelerated hashing 2022-02-03 14:58:02 +01:00
kernel_version.c avoid using strok - eliminates use of hidden global variable 2020-10-06 02:36:47 +02:00
last_char_is.c libbb: shrink last_char_is(), no longer allow NULL string argument 2020-07-19 20:49:22 +02:00
lineedit_ptr_hack.c
lineedit.c lineedit: get PWD from ash 2022-07-03 21:41:38 +02:00
llist.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
logenv.c zcip: Add environment variable for overriding log functionality 2014-11-04 12:19:04 +01:00
login.c libbb: introduce and use fputs_stdout 2021-02-03 20:52:40 +01:00
loop.c mount: if we race with other loop mount, we forget to close loop dev 2020-12-17 23:38:06 +01:00
make_directory.c fix compile failure in previous commit 2018-02-06 18:01:39 +01:00
makedev.c
match_fstype.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
messages.c which: fix TODO with NOFORK+malloc_failure misbehaving 2018-01-12 13:21:33 +01:00
missing_syscalls.c Remove stime() function calls 2019-11-19 13:08:25 +01:00
mode_string.c libbb: clarify what bb_mode_string() generates 2021-09-17 17:10:38 +02:00
mtab.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
nuke_str.c whitespace fixes 2018-07-17 15:04:17 +02:00
obscure.c unit-tests: implement the unit-testing framework 2014-06-22 16:30:41 +02:00
parse_config.c getopt32: remove opt_complementary 2017-08-08 21:55:02 +02:00
parse_mode.c libbb: code shrink bb_parse_mode 2021-09-17 00:47:23 +02:00
percent_decode.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
perror_msg.c
perror_nomsg_and_die.c libbb: restore special handling of nomsg errors 2022-06-26 17:17:02 +02:00
perror_nomsg.c libbb: restore special handling of nomsg errors 2022-06-26 17:17:02 +02:00
pidfile.c do not duplicate CONFIG_PID_FILE_PATH and ".pid" strings 2019-03-17 19:48:39 +01:00
platform.c ash: placate -Werror=format-security 2021-02-18 13:45:49 +01:00
print_flags.c whitespace and comment format fixes, no code changes 2017-10-05 15:33:28 +02:00
print_numbered_lines.c libbb: introduce and use fputs_stdout 2021-02-03 20:52:40 +01:00
printable_string.c unzip: use printable_string() for printing filenames 2018-09-30 16:56:56 +02:00
printable.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
process_escape_sequence.c libbb: do not misinterpret 0x10-0x19 chars in "\xNNN" too 2018-11-29 13:16:15 +01:00
procps.c libbb/procps: smaller global data for username/groupname cache 2020-12-30 01:04:56 +01:00
progress.c wget: print the final newline only for non-tty output 2018-11-23 19:14:52 +01:00
ptr_to_globals.c libbb: extend "errno pointer" trick to other than __GLIBC__ 2020-10-01 00:34:44 +02:00
pw_encrypt_des.c libbb: code shrink in des encryption, in setup_salt() 2021-11-28 12:21:23 +01:00
pw_encrypt_md5.c fix assorted unused code and wrong format specs found by cppchekc (bug 6716) 2013-11-29 16:43:33 +01:00
pw_encrypt_sha.c tls: add 2nd cipher_id, TLS_RSA_WITH_AES_128_CBC_SHA, so far it doesn't work 2017-01-24 16:00:54 +01:00
pw_encrypt.c Fix missing "crypt.h" compilation error on the FreeBSD 2021-01-04 13:28:28 +01:00
read_key.c libbb: shrink lineedit_read_key() 2022-01-18 00:36:42 +01:00
read_printf.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
read.c libbb: Converted safe_read to safe_write format 2019-10-09 14:35:55 +02:00
README
recursive_action.c libbb: shrink recursive_action() by reducing memory pressure 2020-10-01 21:52:16 +02:00
remove_file.c libbb: do not check closedir() in remove_file() 2021-06-24 17:39:57 +02:00
replace.c replace: count_strstr - Handle an edge case where sub is empty 2019-10-09 14:39:41 +02:00
rtc.c move ADJTIME_PATH define to header files 2020-12-17 20:53:43 +01:00
run_shell.c libbb: exec_login_shell() - new function 2020-12-02 21:51:08 +01:00
safe_gethostname.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
safe_poll.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
safe_strncpy.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
safe_write.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
securetty.c libbb: fix "error: redefinition of 'is_tty_secure'" 2017-04-13 17:55:05 +02:00
selinux_common.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
setup_environment.c libbb: introduce and use chdir_or_warn() 2022-01-13 12:56:10 +01:00
signals.c runsv: robustify signal handling - SIGTERM to child between vfork and exec could mess things up 2021-06-05 16:20:05 +02:00
simplify_path.c
single_argv.c basename,dirname,freeramdisk,rx,raidautorun,runsv,chvt: skip "--" argument 2011-04-11 03:58:30 +02:00
skip_whitespace.c libbb: Use return value from is_prefixed_with() 2018-02-27 13:35:40 +01:00
speed_table.c decrease paddign: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nilly 2020-11-30 13:03:03 +01:00
str_tolower.c
strrstr.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
sysconf.c libbb: add sanity check in bb_arg_max() 2014-12-24 01:46:29 +01:00
time.c libbb: code shrink parse_datestr (again) 2021-09-18 22:55:46 +02:00
trim.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
u_signal_names.c libbb/u_signal_names.c: don't check errno after bb_strtou 2018-10-31 11:28:37 +01:00
ubi.c ubi tools: ubiupdatevol supports "-" input and actually respects -s SIZE 2017-08-07 16:00:25 +02:00
udp_io.c udp_io, traceroute: Standardise IPv6 PKTINFO handling to be portable 2017-10-30 16:06:50 +01:00
unicode.c unicode: relax array alignment for tables 2020-11-30 11:30:17 +01:00
update_passwd.c update_passwd: fix context variable 2021-01-14 17:03:25 +01:00
utmp.c *: Switch to POSIX utmpx API 2015-04-02 23:03:46 +02:00
uuencode.c base32/64: "truncated base64 input" -> "truncated input" 2020-11-28 13:43:54 +01:00
verror_msg.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
vfork_daemon_rexec.c libbb: code shrink: introduce and use [_]exit_SUCCESS() 2022-01-05 22:16:06 +01:00
warn_ignoring_args.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
wfopen_input.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
wfopen.c libbb: new function bb_die_memory_exhausted 2018-04-01 19:59:37 +02:00
write.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
xatonum_template.c whitespace fixes. no code changes 2013-01-15 13:58:01 +01:00
xatonum.c decrease paddign: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nilly 2020-11-30 13:03:03 +01:00
xconnect.c libbb: reuse "bad port" error message string 2021-09-10 09:48:55 +02:00
xfunc_die.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
xfuncs_printf.c libbb: introduce and use chdir_or_warn() 2022-01-13 12:56:10 +01:00
xfuncs.c libbb: code shrink: introduce and use [_]exit_SUCCESS() 2022-01-05 22:16:06 +01:00
xgetcwd.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
xgethostbyname.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
xreadlink.c libbb: better coreutils compatibility for realpath 2021-10-09 01:47:12 +02:00
xrealloc_vector.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
xregcomp.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00

Please see the LICENSE file for copyright information (GPLv2)

libbb is BusyBox's utility library.  All of this stuff used to be stuffed into
a single file named utility.c.  When I split utility.c to create libbb, some of
the very oldest stuff ended up without their original copyright and licensing
information (which is now lost in the mists of time).  If you see something
that you wrote that is mis-attributed, do let me know so we can fix that up.

	Erik Andersen
	<andersen@codepoet.org>