quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] patches for quilt to support older date(1)


From: Urs Thuermann
Subject: [Quilt-dev] patches for quilt to support older date(1)
Date: 18 May 2007 00:03:49 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Please CC: answers to me since I'm not on the mailing list.

I have installed quilt-0.46 on a system with on older version of GNU
date that has two problems:

1. date -d "1970/01/01 UTC $n seconds"   is buggy and prints a wrong
   date.

2. The old date has no %N for nanoseconds.


The first patch works around the bug in date and at the same time
simplifies the quilt code.  There is no need to first convert the date
of the introduction mail to seconds since Epoch and then add to this
Epoch again.  Simply add 1 second, 2 seconds, and so on to the
introduction date:

diff -ru quilt-0.46/quilt/mail.in quilt/quilt/mail.in
--- quilt-0.46/quilt/mail.in    2006-09-05 15:44:45.000000000 +0200
+++ quilt/quilt/mail.in 2007-05-17 23:14:33.000000000 +0200
@@ -401,7 +401,8 @@
 # increment the timestamp by one second and wait with sending until
 # that time has arrived. This allows MUAs to show the messages in the
 # correct order.
-last_ts=$(date '+%s' -d "$(sed -ne $'s/^Date:[ \t]*//p' $introduction)")
+intro_date=$(sed -ne $'s/^Date:[ \t]*//p' $introduction)
+ts_diff=0
 
 num=1
 for patch in "address@hidden"; do
@@ -411,8 +412,8 @@
        #while [ $(date '+%s') -le $last_ts ]; do
        #       sleep 1
        #done
-       ((last_ts++))
-       new_date="$(date --rfc-822 -d "1970/01/01 UTC $last_ts seconds")"
+       ((ts_diff++))
+       new_date="$(date --rfc-822 -d "$intro_date $ts_diff seconds")"
 
        modify="$(awk '
        sub(/^Recipient-/, "")  { r = $0



The second patch replaces %N for nano seconds by $pid and a count
starting from 0.  Maybe this should be used in conjunction with a
autoconf test to check if the installed date command supports %N.

diff -ru quilt-0.46/quilt/mail.in quilt/quilt/mail.in
--- quilt-0.46/quilt/mail.in    2006-09-05 15:44:45.000000000 +0200
+++ quilt/quilt/mail.in 2007-05-17 23:28:44.000000000 +0200
@@ -64,7 +64,7 @@
 
 msgid()
 {
-       local timestamp=$(date --utc "+%Y%m%d%H%M%S.%N")
+       local timestamp=$(date --utc "+%Y%m%d%H%M%S.$$.$1")
        echo "address@hidden@}"
 }
 
@@ -332,7 +332,7 @@
 introduction="$(gen_tempfile)"
 (
        cat <<-EOF
-       Message-Id: <$(msgid)>
+       Message-Id: <$(msgid 0)>
        User-Agent: quilt/@address@hidden@RELEASE@
        Date: $(date --rfc-822)
        From: ${opt_from:-$opt_sender}
@@ -432,7 +432,7 @@
        ' $body)"
        p=${subject_prefix//@num@/$(printf %0*d ${#total} $num)}
        p=${p//@total@/$total}
-       (       echo "Message-Id: <$(msgid)>"
+       (       echo "Message-Id: <$(msgid $num)>"
                sed -n -e '/^$/q' \
                    -e 's/^Message-Id:/References:/' \
                    -e p \



urs




reply via email to

[Prev in Thread] Current Thread [Next in Thread]