#5407 fix make-git-checkout-seed script
Closed: Fixed None Opened 7 years ago by kevin.

We have a cron job in ansible that runs on the pkgs02 server that collects a checkout of all Fedora packages.

For some reason it has started to fail recently. The output from the cron is:

{{{
Subject: Cron root@pkgs02 /usr/local/bin/lock-wrapper make-git-checkout-seed "/usr/local/bin/make-git-checkout-seed.sh | /usr/local/bin/nag-once make-git-checkout-seed 1d 2>&1"
Date: Mon, 18 Jul 2016 02:12:31 +0000 (UTC)

basename: extra operand ‘enunciate-core-annotations).git’
Try 'basename --help' for more information.
sed: can't read /srv/git_seed/git-checkout//.git/config: No such file or directory
sed: can't read /srv/git_seed/git-checkout//.git/config: No such file or directory
}}}

We need to find out why it's failing and fix it. :)


Is anyone working on this?

Replying to [comment:2 audi3947]:

Is anyone working on this?

Yes :).

I managed to produce similar error message locally on my box with a repo name containing spaces. I suspect there might be a directory ending with ‘enunciate-core-annotations).git’ in /srv/git/repositories that contains spaces. Could you have a look for me and perhaps confirm/reject this idea? I tried but I only seem to have access to a gitolite console on pkgs.fedoraproject.org.

Note that the attached patch is not a complete thing to support whitespaces in repo names as I realized after digging a bit deeper. I have a finished patch ready on my machine but I'll wait with uploading till we get more info.

I might be missing something, but I cannot see any directories there with a space in the name. ;(

I could generate a ls -l of the dir and attach it here for you to take a look at?

Replying to [comment:5 kevin]:

I might be missing something, but I cannot see any directories there with a space in the name. ;(

I could generate a ls -l of the dir and attach it here for you to take a look at?

That would be helpful. Thanks. I'll put more effort into the investigation :).

Replying to [comment:7 kevin]:

https://kevin.fedorapeople.org/ls-git

is a ls -l of the git repos.

From freenode #sh irc channel from greybot:

"Double quote" every literal that contains spaces/metacharacters and every expansion: "$var", "$(command "$var")", "${array[@]}", "a & b". Use 'single quotes' for code or literal $'s: 'Costs $5 US', ssh host 'echo "$HOSTNAME"'. See http://mywiki.wooledge.org/Quotes , http://mywiki.wooledge.org/Arguments and http://wiki.bash-hackers.org/syntax/words.

So yeah, the only explanation that I could come up with is that there is a directory that contains spaces/metacharacters but ls -l of the git repos that you sent looks alright. I even recreated the directory structure according to what the script expects and from the data from the ls-git file and then run the exact command that produces the error on pkgs02. It ran with no visible errors.

I am kind of out of ideas at the moment. Is the script still failing as of today? I could submit a patch that double quotes all the expansions but that shouldn't be necessary.

Kevin, do you think we could add some debugging info directly into the script? Something like:

{{{
bname=$(basename $repo .git || (echo date > /tmp/ticket5407-debug && echo "$repo" >> /tmp/ticket5407-debug && ls -l /srv/git/repositories >> /tmp/ticket5407-debug))
}}}

I know it is very primitive and might not bring anything new but I would really like to see this data at the point the script hits the problem.

Yeah, we could... but we are in freeze right now, so it would need a freeze break.

Probibly just worth waiting until after freeze is over.

ok. I added debugging in, lets see what it says next time it runs. ;)

And bingo, the debugging shows:

lrwxrwxrwx. 1 root packager 80 Jul 14 13:11 /srv/git/repositories/enunciate (Re-review: enunciate-core-annotations).git -> /srv/git/repositories/rpms/enunciate (Re-review: enunciate-core-annotations).git

I've removed this bogus link and we should be all set now. ;)

Thanks for the debugging assistance.

Kevin, I am glad we have found something out but I cannot see the link in the original ls -l ​that you sent (https://kevin.fedorapeople.org/ls-git). That would make me think that the problem could reoccur but the date of the link generation (Jul 14 13:11) says it was last generated before this issue was opened. This is still curious to me.

Yeah, I am not sure either. Note that this was the link in /srv/git/repositories, not the files in /srv/git/repositories/rpms/

in any case hopefully it's all happy now.

Login to comment on this ticket.

Metadata