From: linuxtestproject.agent@gmail.com
To: panzhe <panzhe@kylinos.cn>
Cc: LTP AI Reviewer <ltp-ai-reviewer@lists.linux.it>, ltp@lists.linux.it
Subject: Re: [LTP] gethostname02: Accept EOVERFLOW on alpha
Date: Tue, 2 Jun 2026 11:26:56 +0000 [thread overview]
Message-ID: <20260602112656.4143-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260602090214.252840-1-panzhe@kylinos.cn>
Hi panzhe,
On Tue, 2026-06-02 at 17:02 +0800, panzhe wrote:
> gethostname02: Accept EOVERFLOW on alpha
>
> On alpha glibc's gethostname() directly calls the kernel
> syscall and sets errno to EOVERFLOW when the buffer is
> too small, because the kernel truncates silently and the
> string is not null terminated.
>
> On the other hand, the generic posix implementation used
> on x86_64 sets ENAMETOOLONG in this case.
>
> Fix this by accepting both errnos.
>
> Closes: https://github.com/linux-test-project/ltp/issues/1319
> Signed-off-by: panzhe <panzhe@kylinos.cn>
Commit message: OK. The alpha-specific behaviour is confirmed by glibc's
sysdeps/unix/sysv/linux/alpha/gethostname.c:
result = INLINE_SYSCALL(gethostname, 2, name, len);
if (result == 0 && memchr(name, '\0', len) == NULL) {
__set_errno(EOVERFLOW);
result = -1;
}
When the kernel truncates the hostname to exactly `len` bytes (no null
terminator), glibc detects the missing '\0' and raises EOVERFLOW. The
commit message accurately describes this.
> - TST_EXP_FAIL(gethostname(hostname, real_length - 1), ENAMETOOLONG,
> + const int exp_errnos[] = {ENAMETOOLONG, EOVERFLOW};
> + TST_EXP_FAIL_ARR(gethostname(hostname, real_length - 1),
> + exp_errnos, ARRAY_SIZE(exp_errnos),
> + "len is smaller than the actual size");
TST_EXP_FAIL_ARR usage is correct. The array is passed as const int *,
matching the tst_errno_in_set() signature. ARRAY_SIZE is preferred over a
hardcoded count. EOVERFLOW is available via <errno.h>, which tst_test.h
already includes.
Note: ltp-linter was not available in the review environment and could not
be run.
Verdict: Reviewed
Reviewed-by: LTP AI Reviewer <ltp-ai-reviewer@lists.linux.it>
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-06-02 11:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 9:02 [LTP] [PATCH v2] gethostname02: Accept EOVERFLOW on alpha panzhe
2026-06-02 11:26 ` linuxtestproject.agent [this message]
2026-06-02 15:57 ` Andrea Cervesato via ltp
2026-06-02 17:34 ` Avinesh Kumar via ltp
-- strict thread matches above, loose matches on Subject: below --
2026-06-03 1:49 [LTP] [PATCH v3] " panzhe
2026-06-03 4:09 ` [LTP] " linuxtestproject.agent
2026-06-02 4:17 [LTP] [PATCH] " panzhe
2026-06-02 8:39 ` [LTP] " linuxtestproject.agent
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260602112656.4143-1-linuxtestproject.agent@gmail.com \
--to=linuxtestproject.agent@gmail.com \
--cc=ltp-ai-reviewer@lists.linux.it \
--cc=ltp@lists.linux.it \
--cc=panzhe@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox