{"thread":{"id":"25650","subject":"pretty format can't work on cron job","startedAt":"2010-11-05T08:29:00Z","lastAt":"2010-11-08T02:30:19Z","messageCount":7,"participants":["chen_wang@trendmicro.com.cn","Johannes Sixt","Jeff King","Chen WANG","Thomas Rast"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"155247","messageId":"7B2091481B9ED640A92789B0CA07059587CCF7@CDCEXMAIL02.tw.trendnet.org","threadId":"25650","inReplyTo":null,"subject":"pretty format can't work on cron job","fromName":"","fromEmail":"chen_wang@trendmicro.com.cn","sentAt":"2010-11-05T08:29:00Z","receivedAt":"2010-11-05T08:29:00Z","isPatch":false,"sender":{"key":"chen_wang@trendmicro.com.cn","avatar":null},"body":"\nFor the command: git log 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.. -M --date=short --pretty=format:\"Author: %aN <%ae>; Date: %ad\" --shortstat --dirstat --no-merges\n\nI run it on shell by manual can create correct format of output, such as:\n-------------------------------------------------\nAuthor: Amit Shah <amit.shah@redhat.com>; Date: 2010-10-20\n 1 files changed, 14 insertions(+), 3 deletions(-)\n 100.0% drivers/char/\n-------------------------------------------------\n\nBut when I put that command on cron job, even I run “. /etc/profile” and “. ~/.bash_profile” first, I can’t get correct format of output.\n-------------------------------------------------\nAuthor: %aN <amit.shah@redhat.com>; Date: Wed Oct 20 13:45:43 2010 +1030\n 100.0% drivers/char/\n 1 files changed, 14 insertions(+), 3 deletions(-)\n-------------------------------------------------\n\nMy git version is git-1.7.3.2.\n\nDoes anyone know the reason?\n\nThanks\nChen\n\nTREND MICRO EMAIL NOTICE\nThe information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system."},{"id":"155250","messageId":"4CD3C262.6080108@viscovery.net","threadId":"25650","inReplyTo":"7B2091481B9ED640A92789B0CA07059587CCF7@CDCEXMAIL02.tw.trendnet.org","subject":"Re: pretty format can't work on cron job","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-11-05T08:37:54Z","receivedAt":"2010-11-05T08:37:54Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 11/5/2010 9:29, schrieb chen_wang@trendmicro.com.cn:\n> \n> For the command: git log 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.. -M --date=short --pretty=format:\"Author: %aN <%ae>; Date: %ad\" --shortstat --dirstat --no-merges\n> \n> I run it on shell by manual can create correct format of output, such as:\n> -------------------------------------------------\n> Author: Amit Shah <amit.shah@redhat.com>; Date: 2010-10-20\n>  1 files changed, 14 insertions(+), 3 deletions(-)\n>  100.0% drivers/char/\n> -------------------------------------------------\n> \n> But when I put that command on cron job, even I run “. /etc/profile” and “. ~/.bash_profile” first, I can’t get correct format of output.\n> -------------------------------------------------\n> Author: %aN <amit.shah@redhat.com>; Date: Wed Oct 20 13:45:43 2010 +1030\n>  100.0% drivers/char/\n>  1 files changed, 14 insertions(+), 3 deletions(-)\n> -------------------------------------------------\n\n% has a special meaning in a crontab. See man 5 crontab.\n\n-- Hannes\n"},{"id":"155253","messageId":"7B2091481B9ED640A92789B0CA07059587CD03@CDCEXMAIL02.tw.trendnet.org","threadId":"25650","inReplyTo":"4CD3C262.6080108@viscovery.net","subject":"RE: pretty format can't work on cron job","fromName":"","fromEmail":"chen_wang@trendmicro.com.cn","sentAt":"2010-11-05T08:47:05Z","receivedAt":"2010-11-05T08:47:05Z","isPatch":false,"sender":{"key":"chen_wang@trendmicro.com.cn","avatar":null},"body":"> -----Original Message-----\n> From: Johannes Sixt [mailto:j.sixt@viscovery.net]\n> Sent: 2010年11月5日 16:38\n> To: Chen Wang (QA-CN)\n> Cc: git@vger.kernel.org; ellre923@gmail.com\n> Subject: Re: pretty format can't work on cron job\n> \n> Am 11/5/2010 9:29, schrieb chen_wang@trendmicro.com.cn:\n> >\n> > For the command: git log 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.. -M\n> --date=short --pretty=format:\"Author: %aN <%ae>; Date: %ad\" --shortstat\n> --dirstat --no-merges\n> >\n> > I run it on shell by manual can create correct format of output, such as:\n> > -------------------------------------------------\n> > Author: Amit Shah <amit.shah@redhat.com>; Date: 2010-10-20\n> >  1 files changed, 14 insertions(+), 3 deletions(-)\n> >  100.0% drivers/char/\n> > -------------------------------------------------\n> >\n> > But when I put that command on cron job, even I run “. /etc/profile” and “.\n> ~/.bash_profile” first, I can’t get correct format of output.\n> > -------------------------------------------------\n> > Author: %aN <amit.shah@redhat.com>; Date: Wed Oct 20 13:45:43 2010\n> +1030\n> >  100.0% drivers/char/\n> >  1 files changed, 14 insertions(+), 3 deletions(-)\n> > -------------------------------------------------\n> \n> % has a special meaning in a crontab. See man 5 crontab.\n> \n\nI warped this command in script and trigger script in crontab.\nI think it's not the root cause, because %ae still works.\n\n> -- Hannes\n\nTREND MICRO EMAIL NOTICE\nThe information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system."},{"id":"155258","messageId":"20101105131444.GB11707@sigill.intra.peff.net","threadId":"25650","inReplyTo":"7B2091481B9ED640A92789B0CA07059587CD03@CDCEXMAIL02.tw.trendnet.org","subject":"Re: pretty format can't work on cron job","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-11-05T13:14:44Z","receivedAt":"2010-11-05T13:14:44Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Nov 05, 2010 at 04:47:05PM +0800, chen_wang@trendmicro.com.cn wrote:\n\n> > > But when I put that command on cron job, even I run “. /etc/profile” and “.\n> > ~/.bash_profile” first, I can’t get correct format of output.\n> > > -------------------------------------------------\n> > > Author: %aN <amit.shah@redhat.com>; Date: Wed Oct 20 13:45:43 2010\n> > +1030\n> > >  100.0% drivers/char/\n> > >  1 files changed, 14 insertions(+), 3 deletions(-)\n> > > -------------------------------------------------\n> > \n> > % has a special meaning in a crontab. See man 5 crontab.\n> > \n> \n> I warped this command in script and trigger script in crontab.\n> I think it's not the root cause, because %ae still works.\n\nI notice that the only placeholder that is broken is %aN, which converts\nusing the .mailmap file. Maybe something in your environment is\npreventing reading that file properly?\n\nCan you show us the exact script you're calling from your crontab file?\nI'm wondering if it's something to do with being in the same directory.\n\n-Peff\n"},{"id":"155278","messageId":"01c101cb7d6c$fd053cf0$f70fb6d0$@com","threadId":"25650","inReplyTo":"20101105131444.GB11707@sigill.intra.peff.net","subject":"RE: pretty format can't work on cron job","fromName":"Chen WANG","fromEmail":"ellre923@gmail.com","sentAt":"2010-11-06T04:42:07Z","receivedAt":"2010-11-06T04:42:07Z","isPatch":false,"sender":{"key":"ellre923@gmail.com","avatar":null},"body":"> -----Original Message-----\n> From: Jeff King [mailto:peff@peff.net]\n> Sent: 2010年11月5日 21:15\n> To: chen_wang@trendmicro.com.cn\n> Cc: j.sixt@viscovery.net; git@vger.kernel.org; ellre923@gmail.com\n> Subject: Re: pretty format can't work on cron job\n> \n> On Fri, Nov 05, 2010 at 04:47:05PM +0800, chen_wang@trendmicro.com.cn\n> wrote:\n> \n> > > > But when I put that command on cron job, even I run “. /etc/profile” and\n> “.\n> > > ~/.bash_profile” first, I can’t get correct format of output.\n> > > > -------------------------------------------------\n> > > > Author: %aN <amit.shah@redhat.com>; Date: Wed Oct 20 13:45:43 2010\n> > > +1030\n> > > >  100.0% drivers/char/\n> > > >  1 files changed, 14 insertions(+), 3 deletions(-)\n> > > > -------------------------------------------------\n> > >\n> > > % has a special meaning in a crontab. See man 5 crontab.\n> > >\n> >\n> > I warped this command in script and trigger script in crontab.\n> > I think it's not the root cause, because %ae still works.\n> \n> I notice that the only placeholder that is broken is %aN, which converts\n> using the .mailmap file. Maybe something in your environment is\n> preventing reading that file properly?\n> \n\n$ ll .mailmap\n-rw-r--r-- 1 wangchen club 4021 Oct 15 06:18 .mailmap\n\n> Can you show us the exact script you're calling from your crontab file?\n> I'm wondering if it's something to do with being in the same directory.\n> \n\nSure.\n$ crontab -l\n58 06 * * * /home/wangchen/kps_update\n$ cat /home/wangchen/kps_update\n#!/bin/bash\nsu wangchen -\n. /etc/profile\n. ~/.bash_profile\ncd /home/wangchen/kps\ngit pull\nmake\ncd /home/wangchen/linux-2.6\ngit pull\n/home/wangchen/kps/kps_web/kps_do /home/wangchen/linux-2.6 /home/wangchen/kps\n$ cat /home/wangchen/kps/kps_web/kps_do\n#!/bin/sh\n#check script parameters\nif [ -r $1 -a -w $2 ]; then\n        echo \"begin to update kps_result\"\n        readonly LGP=$1\n        KGP=$2\n        KGP=${KGP%%/}\nelse\n        echo \"usage: $0 linux_kernel_source_dir kps_source_dir\"\n        exit 1\nfi\ncd $LGP\ngit log 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.. -M --date=short --pretty=format:\"Author: %aN <%ae>; Date: %ad\" --shortstat --dirstat --no-merges >/tmp/ChangeLog-all\n\n> -Peff\n"},{"id":"155343","messageId":"201011072018.31740.trast@student.ethz.ch","threadId":"25650","inReplyTo":"01c101cb7d6c$fd053cf0$f70fb6d0$@com","subject":"Re: pretty format can't work on cron job","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-11-07T19:18:31Z","receivedAt":"2010-11-07T19:18:31Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Chen WANG wrote:\n> $ cat /home/wangchen/kps_update\n> #!/bin/bash\n> su wangchen -\n\nWhat is this 'su' supposed to do?  AFAICS you would have to run\nanother script with 'su' if you really want to change user.\n\n> git log 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.. -M --date=short --pretty=format:\"Author: %aN <%ae>; Date: %ad\" --shortstat --dirstat --no-merges >/tmp/ChangeLog-all\n[%aN does not expand to anything within the cron runs]\n\nAlso, what git version(s) do you have installed?  %aN appeared in\n1.5.6.4 and 1.6.0, so it is entirely possible that the $PATH within\nyour cronjob runs an older version which fails to expand it to\nanything.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"155352","messageId":"020101cb7eec$e5d1baa0$b1752fe0$@com","threadId":"25650","inReplyTo":"201011072018.31740.trast@student.ethz.ch","subject":"RE: pretty format can't work on cron job","fromName":"Chen WANG","fromEmail":"ellre923@gmail.com","sentAt":"2010-11-08T02:30:19Z","receivedAt":"2010-11-08T02:30:19Z","isPatch":false,"sender":{"key":"ellre923@gmail.com","avatar":null},"body":"> -----Original Message-----\n> From: Thomas Rast [mailto:trast@student.ethz.ch]\n> Sent: 2010年11月8日 3:19\n> To: Chen WANG\n> Cc: 'Jeff King'; Chen Wang (QA-CN); j.sixt@viscovery.net; git@vger.kernel.\norg\n> Subject: Re: pretty format can't work on cron job\n> \n> Chen WANG wrote:\n> > $ cat /home/wangchen/kps_update\n> > #!/bin/bash\n> > su wangchen -\n> \n> What is this 'su' supposed to do?  AFAICS you would have to run\n> another script with 'su' if you really want to change user.\n> \n\nIgnore it please. I put a lot rubbish here to try to figure out the issue.\n\n> > git log 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.. -M --date=short\n> --pretty=format:\"Author: %aN <%ae>; Date: %ad\" --shortstat --dirstat\n> --no-merges >/tmp/ChangeLog-all\n> [%aN does not expand to anything within the cron runs]\n> \n> Also, what git version(s) do you have installed?  %aN appeared in\n> 1.5.6.4 and 1.6.0, so it is entirely possible that the $PATH within\n> your cronjob runs an older version which fails to expand it to\n> anything.\n> \n\nAbsolutely right.\nI was keeping figure out the difference between manual run and cron job for\ngit.\nBut seems my administrator installed a 1.5.5.4 for global, but my local bin\nhas a higher version of git which support %aN.\nThanks guys. Thanks Thomas.\n\n> --\n> Thomas Rast\n> trast@{inf,student}.ethz.ch\n"}]}