[yocto] Badly formatted subpath for git SRC_URI deletes portions of hard drive.

Paul Eggleton paul.eggleton at linux.intel.com
Thu Apr 16 05:55:39 PDT 2015


Hi John,

On Thursday 16 April 2015 11:52:48 John Ernberg wrote:
> I was writing a bitbake recipe for a project hosted on a git-server. I
> applied subpath in order to limit the checkout to a specific directory.
> 
> When I ran the recipe it failed in do_fetch (or do_unpack) complaining
> about missing files. It had deleted the entire Yocto directory and
> selected directories from my home-dir like ssh-keys, my dir where I keep
> my code, and some configuration files for Thunderbird and my terminal.
> 
> Since I had no Yocto directory left I was unable to debug the recipe.
> 
> After restoring everything I re-created the recipe, this time I also
> saved a copy of the recipe at a safe location.
> At the end of the path given to subpath I had added a '/' as it was not
> specified what the format of the path should be. I figured I would see
> an error if the path was wrong, and technically I did.
> Essentially the SRC_URI looked like this:
> SRC_URI = "git://git@<server+repo>;protocol=ssh;subpath=path/"
> 
> Running the recipe resulted in do_fetch (or do_unpack) failing again and
> complaining about missing files. This time the deletion was on a much
> greater scale, it had deleted so much of my home-dir that my user
> account was rendered entirely useless. The fastest way to recover this
> time was re-installing the machine.
> 
> I was keeping bitbake in my home-dir both of these times.
> 
> The poky version I am using is Daisy.

Very sorry about this :(

Looking at the code I can see at least two problems we need to fix relating to 
this issue. It seems that having '/' either at the start or the end of the 
value was unexpected and would trigger undesirable behaviour.

It may be worth noting in case it wasn't clear that when it is working 
correctly subpath= doesn't do a shallow clone, it still clones the full 
repository, it's just that you only get the specified subdirectory unpacked 
into the work directory after that.

- Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre



More information about the yocto mailing list