In working on a patch for cvs_deploy, http://drupal.org/node/184664, I realized that there's fallback code inside update.module for determining the project name for a given module or theme if it's not included in the .info file. There are only 2 possible cases where this is hit:

A) You've deployed from CVS and your .info files don't define 'project'.
B) You're developing a brand new module or theme that doesn't exist on d.o nor in CVS.

In the case of (A) this fallback code is doing more harm than good, and making cvs_deploy's job much harder to do a proper solution in #184664. :( We have no way to know if there's already a legitimate 'project' attribute or if we should do the more expensive operation of opening and parsing the CVS/Repository file to get the definitive result. This fallback code prevents people from correctly using update.module if they deploy modules via CVS into subdirectories of various module folders searched by core. For example, this doesn't work: sites/all/modules/contrib/foo. #184664 will fix this, but only if we remove this fallback code.

In the case of (B), this fallback code is a futile effort, there's definitely no available update data anyway, so we should just ignore the project entirely.

Patches attached for both update.module in core and update_status.module 5.x-2.* (DRUPAL-5--2 branch).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dww’s picture

Patch for core is fine, but the patch for update_status in contrib is slightly off. We need to invoke hook_system_info_alter() first to give cvs_deploy a chance, then we can give up. ;)

webchick’s picture

Status: Needs review » Needs work

I'm very much +1 for this change, as I desperately want 184664 to happen. It also removes a bunch of code that looks like a bit of a sub-optimal hack anyway.

Tested with the following modules:
- Archive 6.x-0.9-dev tarball (simple, single module)
- Devel 6.x-1.0 tarball (has several additional modules in the module's root directory and, as an extra bonus, a security release in 6.x-1.0)
- Image 6.x-dev tarball (has sub-modules in its "contrib" directory)
- MyTestModule x.x, a module I just invented that has a blank .module file and .info file with only the bare necessities (name, description, core) in order to simulate the custom module/contrib still in development module.

I enabled Archive, Devel, Devel Generate, Image, Image Attach, and MyTestModule.

Before the patch, this shows (as expected):

(green)
Archive 6.x-0.9-dev (2007-Nov-06)
Includes: Archive

Devel 6.x-1.0
Includes: Devel, Devel Generate, Devel Node Access

Image 6.x-1.x-dev (2008-Jan-18)
Includes: Image, Image Attach

(yellow)
mytestmodule Unknown
Includes: MyTestModule

After the patch, the results are the same /except/ mytestmodule is not in the list, at all, as described.

Now, I tried with CVS checkouts of the HEAD versions of each module, rather than tarballs:

Before patch:

(yellow except devel, which is missing a security release)
Archive Unknown
Recommended version: 	6.x-0.1 (2007-Aug-09) 	
Latest version: 	6.x-0.9-dev (2007-Nov-06) 	
Includes: Archive

Security update required!
Devel Unknown
Security update: 	6.x-1.0 (2008-Jan-10) 	
Includes: Devel, Devel Generate, Devel Node Access

Image Unknown
Recommended version: 	6.x-1.x-dev (2008-Jan-18) 	
Includes: Image, Image Attach

mytestmodule Unknown
Includes: MyTestModule

With the patch, none of these are displayed.

Finally, I tested with these same checkouts, and cvs_deploy module. Without the patch:

(all green)

Archive HEAD (2008-Jan-19)
Recommended version: 	6.x-0.1 (2007-Aug-09) 	
Latest version: 	6.x-0.9-dev (2007-Nov-06) 	
Includes: Archive

CVS deploy 6.x-1.x-dev (2008-Jan-19)
Includes: CVS Deploy

Devel 6.x-1.x-dev (2008-Jan-19)
Recommended version: 	6.x-1.0 (2008-Jan-10) 	
Includes: Devel, Devel Generate, Devel Node Access

Image 6.x-1.x-dev (2008-Jan-19)
Includes: Image, Image Attach

mytestmodule Unknown
Includes: MyTestModule

(in other words, looks as I'd expect)

Without the patch, none of these are displayed. This: http://drupal.org/files/issues/cvs_deploy_project_from_cvs_5x.patch didn't apply against the HEAD version so I couldn't confirm whether cvs deploy is just awaiting an update to deal with this situation, or whether it's just carrying on the expected behaviour...

---

The behaviour being exhibited seems like a bug to me. While I'd fully expect MyTestModule to be dropped from the list (along with any other custom/in-development modules), it was rather shocking to see CVS checkouts removed entirely as well, as I've seen many websites with hybrid checkouts like this (sometimes by necessity, if you're dependent on a module by a contrib developers who hasn't quite started using the release system yet). I'd prefer everything be displayed with an "Unknown" next to it (file_scan_directory(.module$)?) than entries missing altogether...

If this is in fact desired behaviour/the only way it can work, then I guess we need to make it clear somewhere that cvs deploy is going to be absolutely required in the event that someone's managing their site via CVS in order to update status to do a bit of good. Currently, the only project it does any good with in all situations is Drupal core itself.

I'm marking needs work, but I might be wrong. Will wait for dww to confirm.

dww’s picture

Status: Needs work » Needs review

A few quick answers:

- update_status can't do *anything* right with CVS checkouts unless you use cvs_deploy, since there's neither a 'project' attribute nor a 'version'. cvs_deploy has been and will always be required if you want update_status to work with a CVS checkout -- that's why i wrote cvs_deploy in the first place. ;)

- no, the HEAD version of cvs_deploy has not been patched to populate the 'project' field yet. i was awaiting decision on this patch, since i don't want to spend my time on that particular approach if for some reason this patch isn't going to land. You can test the 5.x versions of everything via http://drupal.org/node/184664#comment-696076 if you want to see where cvs_deploy is heading.

- if there's no 'project' in the .info, and no cvs_deploy to get it via other means, update.module will be horribly confused about your code, since everything is organized by 'project'. :( i'd rather it just excluded modules it can't possibly tell you anything useful about than print weird things that basically all say "i have no idea WTF this is, sorry".

does that answer your concerns? would you rather i patched cvs_deploy HEAD, too, so you can fully test this?

webchick’s picture

Patching cvs_deploy would help, yeah. I just want to confirm that there's some way for people to see something on those cvs checkouts somehow. :)

dww’s picture

Ok, new patches for both DRUPAL-5 and HEAD cvs_deploy are now at http://drupal.org/node/184664#comment-698781.

dww’s picture

note for testing: the bug 184644 fixes isn't projects that have N modules in subdirs. To see the bug, you want to put your foo directory in sites/all/modules/contrib/foo.

Gábor Hojtsy’s picture

I agree that it is a good idea to remove that fallback code. Looks like some cross-testing wit cvs_deploy is still going on, so I am awaiting results. Sorry I don't have the time to test now.

dww’s picture

Another idea occurred to me: while ripping this out, we could also rip out the fall back code that tries to group modules as parts of core. Again, if there are release tarballs, we've got "project = drupal" in the .info file from the packaging script. if not, we're in cvs_deploy land, and we can just definitively decide if it's core or not based on what repo it's checked out from (basically, we do the same thing to parse the CVS/Repository file from #184644, but we slightly alter the logic to look at the 1st and 3rd elements of the path, not just the 3rd). thoughts?

Gábor Hojtsy’s picture

Well, this issue solves possible issues with checkouts, while your new ideas would just remove some code duplication. In the interest of keeping what works for D6, not to risk more bugs and concentrate on solving problems, I'd not remove that.

dww’s picture

Ok, fair enough. We can leave that code in, since it's not really hurting anything (other than some minor bloat).

webchick’s picture

Status: Needs review » Reviewed & tested by the community

Ok thanks a lot, dww!!

I re-ran my second two tests. with cvs deploy module and the referenced patch applied.

Now the only one that's hidden form view is mytestmodule, which is by design. The rest show up, and it's even smart enough to tell me that SimpleTest HEAD has no releases, and that Drupal 6.0-rc2 has security fixes. :)

So in other words, this patch does no harm to the vast majority of our end users who use tarballs. And it /should/ actually help those who deploy with CVS to see instantly that something is up, and to pursue a solution from there.

Marking RTBC.

dww’s picture

Based on webchick's RTBC, Gabor's positive comments above, and my own further testing, I committed my patch in #1 to DRUPAL-5--2 of update_status: http://drupal.org/cvs?commit=96872 @Gabor: feel free to re-use that commit message if you don't want to compose your own. ;)

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed.

dww’s picture

Yay, thanks! Just committed the fixes to cvs_deploy over at http://drupal.org/node/184664.
What a happy issue queue: http://drupal.org/project/issues/cvs_deploy ;)

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

Anonymous’s picture

Issue summary: View changes

fixing a minor (but confusing) typo