Gnus development mailing list
 help / color / Atom feed
* Message-ID's secret
@ 2019-11-16 14:56 황병희
  2019-11-16 15:14 ` Andreas Schwab
  2019-11-16 15:16 ` Adam Sjøgren
  0 siblings, 2 replies; 11+ messages in thread
From: 황병희 @ 2019-11-16 14:56 UTC (permalink / raw)
  To: The Gnus

Hellow!!!

Really i'm Gnus' fan so i'm wondering Gnus' message-id have some secret.

According my view:
gnu/linux start with "87"
darwin start with "m2"
windows-nt start with "86" or "83"

I saw the source code in message.el but still i do not
understand. Somebody explain about that?

Sincerely,

-- 
^고맙습니다 _地平天成_ 감사합니다_^))//



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Message-ID's secret
  2019-11-16 14:56 Message-ID's secret 황병희
@ 2019-11-16 15:14 ` Andreas Schwab
  2019-11-16 15:46   ` 황병희
  2019-11-16 15:16 ` Adam Sjøgren
  1 sibling, 1 reply; 11+ messages in thread
From: Andreas Schwab @ 2019-11-16 15:14 UTC (permalink / raw)
  To: 황병희; +Cc: The Gnus

On Nov 16 2019, 황병희 wrote:

> According my view:
> gnu/linux start with "87"
> darwin start with "m2"
> windows-nt start with "86" or "83"

The first number is always (user-uid).  "87" is 1000, "m2" is 501, "86"
is 1001, "83" is 1004.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Message-ID's secret
  2019-11-16 14:56 Message-ID's secret 황병희
  2019-11-16 15:14 ` Andreas Schwab
@ 2019-11-16 15:16 ` Adam Sjøgren
  2019-11-17 15:28   ` 황병희
  1 sibling, 1 reply; 11+ messages in thread
From: Adam Sjøgren @ 2019-11-16 15:16 UTC (permalink / raw)
  To: ding

황병희 writes:

> Really i'm Gnus' fan so i'm wondering Gnus' message-id have some secret.

Secret?

> According my view:
> gnu/linux start with "87"
> darwin start with "m2"
> windows-nt start with "86" or "83"
>
> I saw the source code in message.el but still i do not
> understand. Somebody explain about that?

This is the function you want to understand:

  (defun message-unique-id ()
    ;; Don't use microseconds from (current-time), they may be unsupported.
    ;; Instead we use this randomly inited counter.
    (setq message-unique-id-char
          (% (1+ (or message-unique-id-char
                     (random (ash 1 20))))
             ;; (current-time) returns 16-bit ints,
             ;; and 2^16*25 just fits into 4 digits i base 36.
             (* 25 25)))
    (let ((tm (current-time)))
      (concat
       (if (or (eq system-type 'ms-dos)
               ;; message-number-base36 doesn't handle bigints.
               (floatp (user-uid)))
           (let ((user (downcase (user-login-name))))
             (while (string-match "[^a-z0-9_]" user)
               (aset user (match-beginning 0) ?_))
             user)
         (message-number-base36 (user-uid) -1))
       (message-number-base36 (+ (car tm)
                                 (ash (% message-unique-id-char 25) 16)) 4)
       (message-number-base36 (+ (nth 1 tm)
                                 (ash (/ message-unique-id-char 25) 16)) 4)
       ;; Append a given name, because while the generated ID is unique
       ;; to this newsreader, other newsreaders might otherwise generate
       ;; the same ID via another algorithm.
       ".fsf")))

One way to figure out what happens is to use the M-x edebug-defun
command on the function, and then calling it. You will then be able to
step through the function, seeing every return value along the way. Here
is the manual:

 · https://www.gnu.org/software/emacs/manual/html_node/eintr/edebug.html

It is quite handy!

E.g. the "87" you see is due to your uid, from the line:

         (message-number-base36 (user-uid) -1))


  Best regards,

    Adam

-- 
 "I wish *I* was a tiger!"                                     Adam Sjøgren
 "A common lament."                                       asjo@koldfront.dk
 




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Message-ID's secret
  2019-11-16 15:14 ` Andreas Schwab
@ 2019-11-16 15:46   ` 황병희
  0 siblings, 0 replies; 11+ messages in thread
From: 황병희 @ 2019-11-16 15:46 UTC (permalink / raw)
  To: The Gnus

Andreas Schwab <schwab@linux-m68k.org> writes:

> On Nov 16 2019, 황병희 wrote:
>
>> According my view:
>> gnu/linux start with "87"
>> darwin start with "m2"
>> windows-nt start with "86" or "83"
>
> The first number is always (user-uid).  "87" is 1000, "m2" is 501, "86"
> is 1001, "83" is 1004.

Wow! It was real secret!!! FANTASTIC!!! Thank You Andreas^^^

> Andreas.

Sincerely,

-- 
^고맙습니다 _地平天成_ 감사합니다_^))//



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Message-ID's secret
  2019-11-16 15:16 ` Adam Sjøgren
@ 2019-11-17 15:28   ` 황병희
  2019-11-17 16:40     ` Adam Sjøgren
  0 siblings, 1 reply; 11+ messages in thread
From: 황병희 @ 2019-11-17 15:28 UTC (permalink / raw)
  To: ding

>          (message-number-base36 (user-uid) -1))

Sorry still i do not understand what that means.
We can set other user-uid by setq?

Sincerely,

-- 
^고맙습니다 _地平天成_ 감사합니다_^))//

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Message-ID's secret
  2019-11-17 15:28   ` 황병희
@ 2019-11-17 16:40     ` Adam Sjøgren
  2019-11-18 13:35       ` 황병희
  2019-11-19  4:59       ` 황병희
  0 siblings, 2 replies; 11+ messages in thread
From: Adam Sjøgren @ 2019-11-17 16:40 UTC (permalink / raw)
  To: ding

황병희 writes:

>>          (message-number-base36 (user-uid) -1))
>
> Sorry still i do not understand what that means.

Let's unpack inside-out:

,----[ C-h f user-uid RET ]
| user-uid is a built-in function in ‘C source code’.
| 
| (user-uid)
| 
|   Probably introduced at or before Emacs version 18.
|   This function does not change global state, including the match data.
| 
| Return the effective uid of Emacs.
| Value is a fixnum, if it’s small enough, otherwise a bignum.
`----

So we get the uid of the user running Emacs. If you're on a one-user
Linux-system, that's often 1000.

For example, on my Debian GNU/Linux machine:

  $ grep $USER /etc/passwd
  asjo:x:1000:1000:Adam Sjøgren,,,:/home/asjo:/bin/bash

my uid is 1000.

Now, the next function:

,----[ C-h f message-number-base36 RET ]
| message-number-base36 is a compiled Lisp function in ‘message.el’.
| 
| (message-number-base36 NUM LEN)
| 
| Not documented.
`----

Not documented, but we can guess what it does from the name - it takes a
number and a length as input, and converts it to base36.

Here is the entire function from message.el:

  (defun message-number-base36 (num len)
    (if (if (< len 0)
            (<= num 0)
          (= len 0))
        ""
      (concat (message-number-base36 (/ num 36) (1- len))
              (char-to-string (aref "zyxwvutsrqponmlkjihgfedcba9876543210"
                                    (% num 36))))))

As 1000 is 27*36 + 28*1, you can see it gets translated into "87" by
this function.

So there is no secret here.

> We can set other user-uid by setq?

No, but if you run Emacs as another user, with another uid, you get
another beginning of your Message-ID.


  Best regards,

    Adam

-- 
 "I wish *I* was a tiger!"                                     Adam Sjøgren
 "A common lament."                                       asjo@koldfront.dk
 




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Message-ID's secret
  2019-11-17 16:40     ` Adam Sjøgren
@ 2019-11-18 13:35       ` 황병희
  2019-11-19  4:59       ` 황병희
  1 sibling, 0 replies; 11+ messages in thread
From: 황병희 @ 2019-11-18 13:35 UTC (permalink / raw)
  To: ding

> As 1000 is 27*36 + 28*1, you can see it gets translated into "87" by
> this function.
>
> So there is no secret here.

Wow your comment is very clean. Now i did understand, thanks Adam^^^

Sincerely,

-- 
^고맙습니다 _地平天成_ 감사합니다_^))//



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Message-ID's secret
  2019-11-17 16:40     ` Adam Sjøgren
  2019-11-18 13:35       ` 황병희
@ 2019-11-19  4:59       ` 황병희
  2019-11-20  4:33         ` 황병희
  1 sibling, 1 reply; 11+ messages in thread
From: 황병희 @ 2019-11-19  4:59 UTC (permalink / raw)
  To: ding

> No, but if you run Emacs as another user, with another uid, you get
> another beginning of your Message-ID.

So i did make other account (byunghee:51547) in Ubuntu 18.04.
Really thanks Adam, indeed...;;;

Sincerely,

-- 
^고맙습니다 _地平天成_ 감사합니다_^))//



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Message-ID's secret
  2019-11-19  4:59       ` 황병희
@ 2019-11-20  4:33         ` 황병희
  2019-11-21 12:39           ` 황병희
  0 siblings, 1 reply; 11+ messages in thread
From: 황병희 @ 2019-11-20  4:33 UTC (permalink / raw)
  To: ding

byunghee.hwang@daum.net (황병희) writes:

>> No, but if you run Emacs as another user, with another uid, you get
>> another beginning of your Message-ID.
>
> So i did make other account (byunghee:51547) in Ubuntu 18.04.
> Really thanks Adam, indeed...;;;

Also i did make some relative simple code [0] with Python. That works only
for me. Really i am so happy^^^

[0]
https://gitlab.com/soyeomul/Gnus/blob/a233ed2e982f997766d342456f95755f9be9b76c/thanks-mid.py

Sincerely,

-- 
^고맙습니다 _地平天成_ 감사합니다_^))//



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Message-ID's secret
  2019-11-20  4:33         ` 황병희
@ 2019-11-21 12:39           ` 황병희
  2019-11-21 22:12             ` 황병희
  0 siblings, 1 reply; 11+ messages in thread
From: 황병희 @ 2019-11-21 12:39 UTC (permalink / raw)
  To: The Gnus

> Also i did make some relative simple code [0] with Python. That works only
> for me. Really i am so happy^^^
>
> [0]
> https://gitlab.com/soyeomul/Gnus/blob/a233ed2e982f997766d342456f95755f9be9b76c/thanks-mid.py

There were many typo. So i did update the code [1] with quiet ;;;

[1]
https://gitlab.com/soyeomul/Gnus/blob/4d231b7fc34a2fc8c649f7b6dbd0753c9816504d/thanks-mid.py

Sicnerely,

-- 
^고맙습니다 _地平天成_ 감사합니다_^))//



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Message-ID's secret
  2019-11-21 12:39           ` 황병희
@ 2019-11-21 22:12             ` 황병희
  0 siblings, 0 replies; 11+ messages in thread
From: 황병희 @ 2019-11-21 22:12 UTC (permalink / raw)
  To: The Gnus

soyeomul@doraji.xyz (황병희) writes:

>> Also i did make some relative simple code [0] with Python. That works only
>> for me. Really i am so happy^^^
>>
>> [0]
>> https://gitlab.com/soyeomul/Gnus/blob/a233ed2e982f997766d342456f95755f9be9b76c/thanks-mid.py
>
> There were many typo. So i did update the code [1] with quiet ;;;
>
> [1]
> https://gitlab.com/soyeomul/Gnus/blob/4d231b7fc34a2fc8c649f7b6dbd0753c9816504d/thanks-mid.py

It's real final code [2].

[2]
https://gitlab.com/soyeomul/Gnus/blob/1eb8e8c6f944a4402bac958ba9875bb2815abdfb/thanks-mid.py

Sincerely, Gnus' fan Byung-Hee from South Korea

-- 
^고맙습니다 _地平天成_ 감사합니다_^))//



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, back to index

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-16 14:56 Message-ID's secret 황병희
2019-11-16 15:14 ` Andreas Schwab
2019-11-16 15:46   ` 황병희
2019-11-16 15:16 ` Adam Sjøgren
2019-11-17 15:28   ` 황병희
2019-11-17 16:40     ` Adam Sjøgren
2019-11-18 13:35       ` 황병희
2019-11-19  4:59       ` 황병희
2019-11-20  4:33         ` 황병희
2019-11-21 12:39           ` 황병희
2019-11-21 22:12             ` 황병희

Gnus development mailing list

Archives are clonable: git clone --mirror http://inbox.vuxu.org/ding

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.emacs.gnus.general


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git