New version of mock working (I think)

Michael_E_Brown at Dell.com Michael_E_Brown at Dell.com
Tue Jun 27 21:54:13 UTC 2006


Ok, I didnt see the implications of the status file before, but it looks fine to me. The only problem with that approach that I see is that the caller needs to poll the file to observe status changes. But if that is fine with the buildsystem guys, it works for me.

We shouldnt really need locking on that file. Writes <4k are atomic. Since we are only writing one line at a time to the status file, there is no danger of a reading process seeing an inconsistent file. We should probably just add a flush() statement to make sure that we are not buffering anything past close() (which I think is probably illegal, anyways)
--
Michael


-----Original Message-----
From: fedora-buildsys-list-bounces at redhat.com on behalf of Clark Williams
Sent: Tue 6/27/2006 1:20 PM
To: Discussion of Fedora build system
Cc: mikem at redhat.com
Subject: Re: New version of mock working (I think)
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dan Williams wrote:
> On Tue, 2006-06-27 at 11:15 -0500, Clark Williams wrote:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>
>> Mike McLean wrote:
>>> Clark Williams wrote:
>>>> Not smart enough to argue that we should wait for our build
>>>> system clients to weigh in. Sigh...
>>>>
>>>> Dan/Jeremy/Mike/Andreas/et al
>>>>
>>>> How are you going to use file locking? Do you just want mock
>>>> to lock the status file when we're changing state, or is
>>>> there something else I'm missing?
>>> Pretty much. The lock is to prevent the watcher from reading a
>>> partially written status file.
>> Something like :
>>
>> flock(fileno, LOCK_EX) <write new status> flock(fileno, LOCK_UN)
>>
>> That what you're looking for?
>
> In python:
>
> import fcntl lkfd = open(<lockfile_path>, 'w') rc =
> fcntl.flock(lkfd, fcntl.LOCK_EX) <write new status>
> fcntl.flock(lkfd, fcntl.LOCK_UN) close(lkfd)
>
> Yes.
>
> Dan
>

What, you couldn't tell that was pseudo-python? :)

Clark

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFEoXbRHyuj/+TTEp0RAnUlAJ9HfAgDZP+teHPSeQNdNcCoAWcKuACgslBO
aeOz/hsxMBY6afa7COrXu+I=
=HiV2
-----END PGP SIGNATURE-----

--
Fedora-buildsys-list mailing list
Fedora-buildsys-list at redhat.com
https://www.redhat.com/mailman/listinfo/fedora-buildsys-list




More information about the Fedora-buildsys-list mailing list