Skip Menu |
 

This queue is for tickets about the Module-Build CPAN distribution.

Report information
The Basics
Id: 46919
Status: resolved
Priority: 0/
Queue: Module-Build

People
Owner: Nobody in particular
Requestors: frequency [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.33
Fixed in: (no value)



Subject: Notes Outside of Build.PL Directory
Download (untitled) / with headers
text/plain 585b
If you subclass Module::Build and change directories, then notes fail to be written to disk. Granted, this is more of an issue with my usage of the module, but it would have been nice (and saved me a bit of time) if Module::Build croaked when trying to set notes outside of the initial working directory, or if an absolute path is passed to Module::Build::Notes so that notes can be written per normal. A related documentation patch would be good too. I have limited time at present but could volunteer to patch it at a later date if this is not done by someone else in the meantime.
Download (untitled) / with headers
text/plain 1.6k
On Sat Jun 13 15:54:10 2009, FREQUENCY wrote: Show quoted text
> If you subclass Module::Build and change directories, then notes fail to > be written to disk. Granted, this is more of an issue with my usage of > the module, but it would have been nice (and saved me a bit of time) if > Module::Build croaked when trying to set notes outside of the initial > working directory, or if an absolute path is passed to > Module::Build::Notes so that notes can be written per normal.
All of the serialization stuff in Module::Build assumes that you won't change directories, or that you'll change back to the original directory before it writes stuff out. The test suite actually works pretty hard to enforce this, actually, so that things don't get screwed up. I can see how mention of this in the docs would be useful. How's this? Index: Authoring.pod =================================================================== --- Authoring.pod (revision 12873) +++ Authoring.pod (working copy) @@ -102,7 +102,10 @@ C<create_build_script()> method will ensure that the current value of C<@INC> (including the C</nonstandard/library/path>) is propogated to the Build script, so that My::Builder can be found when running build -actions. +actions. If you find that you need to C<chdir> into different directories +in your subclass methods or actions, be sure to always return to the original +directory (available via the C<base_dir()> method) before returning control +to the parent class. This is important to avoid data serialization problems. For very small additions, Module::Build provides a C<subclass()> method that lets you subclass Module::Build more conveniently, without Best, David
Download (untitled) / with headers
text/plain 1.6k
On Sat Jun 13 15:54:10 2009, FREQUENCY wrote: Show quoted text
> If you subclass Module::Build and change directories, then notes fail to > be written to disk. Granted, this is more of an issue with my usage of > the module, but it would have been nice (and saved me a bit of time) if > Module::Build croaked when trying to set notes outside of the initial > working directory, or if an absolute path is passed to > Module::Build::Notes so that notes can be written per normal.
All of the serialization stuff in Module::Build assumes that you won't change directories, or that you'll change back to the original directory before it writes stuff out. The test suite actually works pretty hard to enforce this, actually, so that things don't get screwed up. I can see how mention of this in the docs would be useful. How's this? Index: Authoring.pod =================================================================== --- Authoring.pod (revision 12873) +++ Authoring.pod (working copy) @@ -102,7 +102,10 @@ C<create_build_script()> method will ensure that the current value of C<@INC> (including the C</nonstandard/library/path>) is propogated to the Build script, so that My::Builder can be found when running build -actions. +actions. If you find that you need to C<chdir> into different directories +in your subclass methods or actions, be sure to always return to the original +directory (available via the C<base_dir()> method) before returning control +to the parent class. This is important to avoid data serialization problems. For very small additions, Module::Build provides a C<subclass()> method that lets you subclass Module::Build more conveniently, without Best, David
added in repository trunk
Subject: Re: [rt.cpan.org #46919] Notes Outside of Build.PL Directory
Date: Mon, 22 Jun 2009 08:22:06 -0400
To: bug-Module-Build [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Download (untitled) / with headers
text/plain 1.1k
David Wheeler via RT wrote: Show quoted text
> Queue: Module-Build > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=46919 > > > On Sat Jun 13 15:54:10 2009, FREQUENCY wrote:
>> If you subclass Module::Build and change directories, then notes fail to >> be written to disk. Granted, this is more of an issue with my usage of >> the module, but it would have been nice (and saved me a bit of time) if >> Module::Build croaked when trying to set notes outside of the initial >> working directory, or if an absolute path is passed to >> Module::Build::Notes so that notes can be written per normal.
> > All of the serialization stuff in Module::Build assumes that you won't > change directories, or that you'll change back to the original directory > before it writes stuff out. The test suite actually works pretty hard to > enforce this, actually, so that things don't get screwed up. I can see > how mention of this in the docs would be useful. How's this?
That seems very fragile. What if MB just stored the original directory location? -- s7ank: i want to be one of those guys that types "s/j&jd//.^$ueu*///djsls/sm." and it's a perl script that turns dog crap into gold.
Subject: Re: [rt.cpan.org #46919] Notes Outside of Build.PL Directory
Date: Mon, 22 Jun 2009 09:44:10 -0400
To: bug-Module-Build [...] rt.cpan.org
From: David Golden <dagolden [...] cpan.org>
Download (untitled) / with headers
text/plain 909b
On Mon, Jun 22, 2009 at 8:22 AM, Michael G Schwern via RT<bug-Module->> All of the serialization stuff in Module::Build assumes that you won't Show quoted text
>> change directories, or that you'll change back to the original directory >> before it writes stuff out. The test suite actually works pretty hard to >> enforce this, actually, so that things don't get screwed up. I can see >> how mention of this in the docs would be useful. How's this?
> > That seems very fragile. > > What if MB just stored the original directory location?
Most distributions assume that they are in the original directory, so while it may be fragile, it's a widespread assumption. Fixing this goes far beyond serialization of Notes, so if it's to be done, it should be done wholesale, not just for this bug. I think documentation is sufficient for the time being. Subclasses should follow the same assumptions as the rest of Module::Build


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.