aws / aws/aws-lambda-base-images
`bash` in `provided.al2023` does not support some features which require file descriptor manipulation when running in Lambda.
- Dominant language
- No language data
- Stars
- 777
- Forks
- 118
- PR merge metrics
- No merged PRs in 30d
Description
The `bash` shipped with AmazonLinux 2023 uses `/dev/fd/*` for some of its file descriptor access. The sandbox in Lambda runs with a statically allocated `/dev/` mount that only has symlinks into `/proc/self/fd` for file descriptors `0`, `1` and `2`.
The end result is that certain `bash` features don't work when using the `bash` shipped in `provided.al2023`.
`bash` itself has code which allows it to use `/proc/self/fd` instead. It's a compile-time feature which only gets enabled if `/dev/fd` is completely absent at the time of `./configure` and `/proc/self/fd/0` is present. You can pass `bash_cv_dev_fd=whacky` to `./configure` to enable it manually.
It would be better for users if the `bash` that ships in `provided.al2023` enabled this option in its build.
```patch
--- bash.spec.orig 2023-01-28 22:29:18.000000000 +0000
+++ bash.spec 2023-12-07 23:27:47.829067001 +0000
@@ -1,7 +1,7 @@
%define _trivial .0
-%define _buildid .2
+%define _buildid .3
#% define beta_tag rc2
%define patchlevel 15
%define baseversion 5.2
%bcond_without tests
@@ -130,11 +130,11 @@
# force refreshing the generated files
rm y.tab.*
%build
autoconf
-%configure --with-bash-malloc=no --with-afs
+%configure --with-bash-malloc=no --with-afs bash_cv_dev_fd=whacky
# Recycles pids is neccessary. When bash's last fork's pid was X
# and new fork's pid is also X, bash has to wait for this same pid.
# Without Recycles pids bash will not wait.
MFLAGS="CPPFLAGS=-D_GNU_SOURCE -DRECYCLES_PIDS -DDEFAULT_PATH_VALUE='\"/usr/local/bin:/usr/bin\"' -DSTANDARD_UTILS_PATH='\"/bin:/usr/bin:/usr/sbin:/sbin\"' `getconf LFS_CFLAGS` -DSYSLOG_HISTORY -DSYSLOG_SHOPT=0"
@@ -319,10 +319,13 @@
%files devel
%{_includedir}/%{name}
%{_libdir}/pkgconfig/%{name}.pc
%changelog
+* Sat Dec 4 2023 Aaron Son - 5.2.15-1.amzn2023.0.3
+- Build with bash_cv_dev_fd=whacky so we look in /proc/self/fd/*. Makes it work with Lambda.
+
* Sat Jan 28 2023 Stewart Smith - 5.2.15-1.amzn2023.0.2
- Mass rebuild for AL2023
* Thu Jan 12 2023 Bojan Smojver - 5.2.15-1.amzn2022.0.1
- Merge Fedora 37
```
Contributor guide
Assessment
This issue has not been assessed yet.