Comments (5)
Can not reproduced on Linux 6.9
from cpython.
May I ask if the /sda3
is your disk device?
from cpython.
@Zheaoli The bug is reproducible on python3.12.3
hosted on Linux kernel 6.9.2-1-MANJARO
.
I suppose you overlooked the blockdev --getsize64 $DEV
statement which implies the exact blockdevice size.
[manjaro@manjaro ~]$ sudo sh
sh-5.2# uname -a
Linux manjaro 6.9.2-1-MANJARO #1 SMP PREEMPT_DYNAMIC Mon May 27 03:56:18 UTC 2024 x86_64 GNU/Linux
sh-5.2# python -VV
Python 3.12.3 (main, Apr 23 2024, 09:16:07) [GCC 13.2.1 20240417]
sh-5.2# modprobe brd rd_nr=1 rd_size=1024
sh-5.2# DEV=/dev/ram0
sh-5.2# SIZE=$(blockdev --getsize64 $DEV)
sh-5.2# tail $DEV
sh-5.2# python3.12 -c "from mmap import mmap;file=open('$DEV','r+b');m=mmap(file.fileno(),$SIZE+1);m.seek($SIZE-4);[m.write(bytes([b])) for b in b'hello world!']"
Bus error (core dumped)
sh-5.2# tail $DEV
hellsh-5.2#
Notice the hellsh
(hell shell) at the end.
from cpython.
The issue confirmed, But I think it's not Python bug I think
The core reason here is that the file size is 1048576
but you map a 1048577
memory to it. So the process SIGBUS now
You need to take care of the SIGBUS when you use the mmap
API
from cpython.
On POSIX, mmap
operations can raise SIGBUS
or SIGSEV
, depending on the platform. Nothing is currently implemented to handle either signal. On Windows, mmap
handles the corresponding exceptions for EXCEPTION_IN_PAGE_ERROR
and EXCEPTION_ACCESS_VIOLATION
by raising OSError
instead of letting the default exception handler terminate the process.
from cpython.
Related Issues (20)
- a biit better example in pathlib docs - maybe include example path that involves file in a folder(s)? HOT 1
- Security branches: Consider fixing the documentation or adding a notice banner HOT 1
- New REPL omits local variables when running ./python -i script.py HOT 2
- importlib.metadata test fixtures should prefer test.support fixtures
- Lacking description of how to correctly implement indexing syntax support.
- Rewrite asyncio subprocesses without child watchers
- Unpickling Exceptions with keyword arguments in multiprocessing throws an error HOT 12
- Reference leak in `_contextvars.Context.run()`
- Allow one to use build.bat to skip building test project files entirely. HOT 4
- CANT FIND THE FUCKING DOWNLOAD BUTTON HOT 2
- Typo in the documentation of the `cmd` parameter of `ftplib.FTP.retrbinary()` HOT 1
- ios buildbot failure: `enclose 'sqlite3_create_window_function' in a __builtin_available check to silence this warning` HOT 1
- generator frame type should not be PyObject*[]
- `subprocess.run` docs should recommend copying `os.environ` on Windows HOT 3
- `faulthandler` itself crashes in free-threading build (in `_Py_DumpExtensionModules`)
- Some Runtime Finalization Constraints Are Not Enforced Nor Documented
- asyncio REPL fails to run with TERM=dumb or PYTHON_BASIC_REPL in 3.13.0b2 HOT 1
- `__module__` is not defined, seeming to contradict the Python Data Model. HOT 13
- `PyDict_Next` should not lock the dict
- `type_setattro` error return paths contain bugs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpython.