[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#710709: debootstrap: consider creating (dangling) /etc/mtab symlink



On Wed, 2019-05-01 at 05:01 +0900, Hideki Yamane wrote:
> control: tags -1 +patch
> 
> revised patch
> 
> > From 55c21c166959a93b961c572d5f366d35d054ce24 Mon Sep 17 00:00:00 2001
> From: Hideki Yamane <henrich@debian.org>
> Date: Wed, 1 May 2019 04:24:43 +0900
> Subject: [PATCH] create symlink from /proc/self/mounts to /etc/mtab
> 
> With old kernel version, there is /proc/mounts instead of
> /proc/self/mounts, so check whether /proc/self exists

This is silly, /proc/self has existed since Linux 0.99 and
/proc/self/mounts since Linux 2.5.1.2.

Ben.

> ---
>  functions | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/functions b/functions
> index 24f0357..46ebceb 100644
> --- a/functions
> +++ b/functions
> @@ -1176,6 +1176,13 @@ setup_proc () {
>  			in_target mount -t sysfs sysfs /sys || true
>  			umount_on_exit /sys
>  		fi
> +		if [ ! -f "$TARGET/etc/mtab" ]; then
> +			if [ -L "$TARGET/proc/self" ]; then
> +				cd "$TARGET/etc" && ln -s ../proc/self/mounts mtab
> +			elif [ -f "$TARGET/proc/mounts" ]; then
> +				cd "$TARGET/etc" && ln -s ../proc/mounts mtab
> +			fi
> +		fi
>  		on_exit clear_mtab
>  		;;
>  	esac
-- 
Ben Hutchings
Anthony's Law of Force: Don't force it, get a larger hammer.

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: