At the moment we end up creating S if it's not created by unpacking an archive or fetching a repository; this is not really ideal in the case where S hasn't been properly set to match where the source actually has been unpacked. Ideally, we should avoid creating S, and then we can know when S hasn't been set correctly because it won't exist, and then we can fail immediately with an appropriate error message telling the user they need to set S, rather than failing with odd errors in later tasks.
After discussion with Paul the conclusion is that the fix probably should result in a warning (at least to start with). Since I already have found around 10 recipes with faulty $S (for example S=WORKDIR/$PN (default) instead of S=WORKDIR) in oe-core, you might assume that a lot of external layers have recipes with this problem as well and display an error and abort might be a bit to hard. At least until people have had the chance to clean this up. Will try to fix faulty 'S' within the scope of this bug as well..
WIP commits: http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=petmab/bug5627
Send for upstream approval. http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=petmab/bug5627 (oe-core) http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=petmab/bug5627_m-y (meta-yocto)
Verified by running: $ bitbake world (with and without sstate) $ bitbake world + archiver enabled $ Manually build + rebuild of affected (changed S value) recipes.
Fixed in cf72ede74d35746a10d0708942287548f9c72f30 (poky). Removed Bug 4634 (https://bugzilla.yoctoproject.org/show_bug.cgi?id=4634) as a depend to this bug, since it's more 'related' than a depend..