Author Oliver Smith
Recipients Oliver Smith
Date 2017-03-03.07:09:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488524974.65.0.103028894103.issue29707@psf.upfronthosting.co.za>
In-reply-to
Content
After mounting a folder to another folder on the same filesystem with mount --bind, os.path.ismount() still returns False on the destination folder (although there is a mountpoint).

A shell script to reproduce this is below.

(Maybe this can be fixed by using /proc/mounts (if available, may not be the case eg. for chroots) for verifying, if the destination folder is really a mountpoint on POSIX/Linux. Although I am not sure how consistent that is through POSIX.)


---
#!/bin/sh
# Output:
# contents of /tmp/destination (should have test.py -> obviously mounted):
# test.py
# os.path.ismount(): False

# create source and destination folders
source=/tmp/source
destination=/tmp/destination
mkdir -p $source $destination

# add the python script in the source folder
echo "import os.path" >> $source/test.py
echo "print('os.path.ismount(): ' + str(os.path.ismount('$destination')))" >> $source/test.py

# do the mount --bind
sudo mount --bind $source $destination
echo "contents of $destination (should have test.py -> obviously mounted):"
ls $destination

# show the python bug
python3 $source/test.py

# clean up
sudo umount $destination
rm $source/test.py
rm -d $source $destination
History
Date User Action Args
2017-03-03 07:09:34Oliver Smithsetrecipients: + Oliver Smith
2017-03-03 07:09:34Oliver Smithsetmessageid: <1488524974.65.0.103028894103.issue29707@psf.upfronthosting.co.za>
2017-03-03 07:09:34Oliver Smithlinkissue29707 messages
2017-03-03 07:09:33Oliver Smithcreate