python / python/cpython

After "make install" the __pycache__ directories are only readable by root

未關閉
#126,086 9 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

build topic-installation type-bug
主要語言
Python
星號
77.2k
分支
36k
PR 合併指標
PR 指標待擷取

描述

Bug report

Bug description:

Building python on RHEL9 with

mkdir tmp; export TMPDIR=$(pwd)/tmp
tar xf /tmp/Python-3.11.10.tar.xz
cd Python-3.11.10/
./configure --enable-optimizations --with-lto
make -s -j
sudo make install

results in a usable python. However only root can read the __pycache__ files, example:

ls -l /usr/local/lib/python3.11/__pycache__

...
-rw-r-----. 1 root root 29675 Oct 28 18:26 zipimport.cpython-311.opt-1.pyc
-rw-r-----. 1 root root 25988 Oct 28 18:26 zipimport.cpython-311.opt-2.pyc
-rw-r-----. 1 root root 29793 Oct 28 18:26 zipimport.cpython-311.pyc

Note that the pycache folder itself is also only readable by root.

To fix this manually one can do

sudo find /usr/local -type d -name '__pycache__' -exec chmod -R a+rX {} \;

but I would have expected make install to do it.

CPython versions tested on:

3.11

Operating systems tested on:

Linux

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

使用報告中的 configure、make 和 sudo make install 指令重現 RHEL9 建置,接著追蹤安裝程序如何建立 pycache 目錄和檔案。當非 root 使用者不需要手動使用 chmod 這個變通方法,就能讀取已安裝的 pycache 目錄和 .pyc 檔案時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
build-system
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。