Deutsch   English   Français   Italiano  
<mailman.37.1729789685.4695.python-list@python.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.mixmin.net!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: MRAB <python@mrabarnett.plus.com>
Newsgroups: comp.lang.python
Subject: Re: shutil.rmtree() fails when used in Fedora (rpm) "mock" environment
Date: Thu, 24 Oct 2024 18:08:02 +0100
Lines: 23
Message-ID: <mailman.37.1729789685.4695.python-list@python.org>
References: <4a13731716200669342338ae409e73ca@posteo.de>
 <CAJQBtg=kCr0VMGXvkBcj4U6CwatC2_G2dstO5pS56_koAXJurA@mail.gmail.com>
 <0c080a7d-92de-4518-ac44-78d97fc9e3bb@mrabarnett.plus.com>
 <CAJQBtg=ButLwvoA2USBEV8-q=taRhuC+t6D1HkJMbG9VzTvxnQ@mail.gmail.com>
 <69934a74-6d04-40a0-a75f-b8024bd0af43@mrabarnett.plus.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de uOOwJ6e3M/UAFboEYbrtBw6NbU0bHg6N5rVNRg6eg8Kg==
Cancel-Lock: sha1:sqbXAIQHs/fEfzTuNlxsXfbtlf4= sha256:J138KtVeLkzjA/m+1/6NSYCOPhheXjWJNFZofXlshlc=
Return-Path: <python@mrabarnett.plus.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
 reason="2048-bit key; unprotected key"
 header.d=plus.com header.i=@plus.com header.b=DQwP7hPS;
 dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(which': 0.04; 'variable':
 0.05; 'subject:when': 0.07; 'from:addr:python': 0.09; 'mechanism':
 0.09; 'pushed': 0.09; 'received:192.168.1.64': 0.09; 'import':
 0.15; 'memory': 0.15; '651': 0.16; '677': 0.16; '679': 0.16;
 '689': 0.16; '760': 0.16; 'appended': 0.16; 'executed': 0.16;
 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16;
 'interpreter': 0.16; 'message-id:@mrabarnett.plus.com': 0.16;
 'received:plus.net': 0.16; 'subject:() ': 0.16; 'subject:Fedora':
 0.16; 'subject:fails': 0.16; 'subject:used': 0.16; 'thread.':
 0.16; 'times,': 0.16; 'wrote:': 0.16; 'problem': 0.16; "can't":
 0.17; 'to:addr:python-list': 0.20; 'problem,': 0.22; 'lines':
 0.23; 'code': 0.23; 'to:name:python-list@python.org': 0.24;
 "isn't": 0.27; 'else': 0.27; 'local': 0.27; 'function': 0.27;
 'header:User-Agent:1': 0.30; 'module': 0.31; "doesn't": 0.32;
 "wouldn't": 0.32; 'but': 0.32; 'received:192.168.1': 0.32;
 'there': 0.33; 'header:In-Reply-To:1': 0.34; 'same': 0.34;
 'trying': 0.35; 'following': 0.35; 'functions': 0.36; 'those':
 0.36; 'received:192.168': 0.37; 'put': 0.38; 'two': 0.39;
 'explain': 0.40; 'something': 0.40; 'once': 0.63; 'right': 0.68;
 'compare': 0.69; 'etc,': 0.69; 'forcing': 0.69; 'times': 0.69;
 'them,': 0.70; 'left': 0.83
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019;
 t=1729789683; bh=QgVUM3dlpVCtI46PLzTiHDHv08WXDh8kBZnhkHQx6lQ=;
 h=Date:Subject:To:References:From:In-Reply-To;
 b=DQwP7hPSrA5MlSG86kLc634SW4pGG8Dpkq9JdgmoZgZdy1NQ5Zl7UBexP2c5UZwWN
 XAwTM1LyZGkvXBfxNJwOZ+4JB0/X4SxuyP1kWOyJXVP/jS+Na3FAZqosZGNdCU+uXK
 crlK6AqdCHGPGnaqLbnF3KB64FaXiVcmjqK1RzcEbP3/y7b0jfxJMbBt7m5aL503KP
 9sNtoktKH3qsJH2KUrSMFwUhOgHDolhmS2N6zuBFVTlKIvxkPmYq8q4LPpLf+A9JlD
 7K4BE0t+u+AM4IldgZWXMd4yb77tiGZ4m0J12WFfsSPUJ8kP2oGLq4laBV/e4w0Sy7
 vUkRMJDoqSTJg==
X-Clacks-Overhead: "GNU Terry Pratchett"
X-CM-Score: 0.00
X-CNFS-Analysis: v=2.4 cv=XaAqz555 c=1 sm=1 tr=0 ts=671a7ef3
 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17
 a=IkcTkHD0fZMA:10 a=B35iVHdzBFL7KPTSH3UA:9 a=QEXdDO2ut3YA:10
X-AUTH: mrabarnett@:2500
User-Agent: Mozilla Thunderbird
Content-Language: en-GB
In-Reply-To: <CAJQBtg=ButLwvoA2USBEV8-q=taRhuC+t6D1HkJMbG9VzTvxnQ@mail.gmail.com>
X-CMAE-Envelope: MS4xfAce2Ygo86HN8M3vPQRbobKrPSx7PIlKG4Ep4OCf4d3Trjt9URonik5c2xUyZO3op+9lMGmxpdIqVp0eJa+U312x72+vfefIT9223Erbwpecvm+hwaWv
 VMVfwR7tfNMvacsxXalP5IGgyuKGPxCfeNZIyp2wIqNViM1TPCwcpsaFxWFafN40XjPaOX+Mjg/EXnmNmIkVXu7HWbdBTnKX7rg=
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
 <python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
 <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
 <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <69934a74-6d04-40a0-a75f-b8024bd0af43@mrabarnett.plus.com>
X-Mailman-Original-References: <4a13731716200669342338ae409e73ca@posteo.de>
 <CAJQBtg=kCr0VMGXvkBcj4U6CwatC2_G2dstO5pS56_koAXJurA@mail.gmail.com>
 <0c080a7d-92de-4518-ac44-78d97fc9e3bb@mrabarnett.plus.com>
 <CAJQBtg=ButLwvoA2USBEV8-q=taRhuC+t6D1HkJMbG9VzTvxnQ@mail.gmail.com>
Bytes: 6104

On 2024-10-24 17:30, Left Right wrote:
> > The stack is created on line 760 with os.lstat and entries are appended
> > on lines 677 (os.rmdir), 679 (os.close) and 689 (os.lstat).
> >
> > 'func' is popped off the stack on line 651 and check in the following lines.
> >
> > I can't see anywhere else where something else is put onto the stack or
> > an entry is replaced.
>
> But how do you know this code isn't executed from different threads?
> What I anticipate to be the problem is that the "os" module is
> imported twice, and there are two references to "os.lstat".  Normally,
> this wouldn't cause a problem, because they are the same function that
> doesn't have any state, but once you are trying to compare them, the
> identity test will fail, because those functions were loaded multiple
> times into different memory locations.
>
> I don't know of any specific mechanism for forcing the interpreter to
> import the same module multiple times, but if that was possible (which
> in principle it is), then it would explain the behavior.
The stack is a local variable and os.lstat, etc, are pushed and popped 
in one function and then another that it calls, so they're in the same 
thread.