Bug#563882: git-core FTBFS on ia64: t1001-read-tree-m-2way.sh test fails
- To: Jonathan Nieder <jrnieder@gmail.com>
- Cc: libc6.1@packages.debian.org, debian-kernel@lists.debian.org, debian-ia64@lists.debian.org, Andreas Metzler <ametzler@downhill.at.eu.org>, 563882@bugs.debian.org, Anders Kaseorg <andersk@MIT.EDU>
- Subject: Bug#563882: git-core FTBFS on ia64: t1001-read-tree-m-2way.sh test fails
- From: Bastian Blank <waldi@debian.org>
- Date: Tue, 26 Jan 2010 22:04:53 +0100
- Message-id: <[🔎] 20100126210453.GY17075@wavehammer.waldi.eu.org>
- Mail-followup-to: Jonathan Nieder <jrnieder@gmail.com>, libc6.1@packages.debian.org, debian-kernel@lists.debian.org, debian-ia64@lists.debian.org, Andreas Metzler <ametzler@downhill.at.eu.org>, 563882@bugs.debian.org, Anders Kaseorg <andersk@MIT.EDU>
- Reply-to: Bastian Blank <waldi@debian.org>, 563882@bugs.debian.org
- In-reply-to: <[🔎] 20100126194834.GA6318@progeny.tock>
- References: <alpine.DEB.2.00.1001052156360.27066@dr-wily.mit.edu> <20100109125206.GA15096@progeny.tock> <20100109133920.GA19534@progeny.tock> <20100124190934.GF3300@downhill.g.la> <20100125000600.GA3234@progeny.tock> <20100125185600.GA3897@downhill.g.la> <20100126061245.GA2324@progeny.tock> <20100126190801.GA5308@downhill.g.la> <[🔎] 20100126194834.GA6318@progeny.tock>
severity 563882 important
retitle 563882 ia64: memchr overshots
thanks
On Tue, Jan 26, 2010 at 01:48:34PM -0600, Jonathan Nieder wrote:
> severity 563882 critical
Please explain. git is neither unrelated to glibc nor does this cause
serious data loss.
> That is, it maps the file into memory and looks for null bytes.
No, the kernel always maps complete pages, so this maps several null
bytes.
> Then this program would lie to you and say “M.out is binary”
The test program does not properly show what is going on.
The following program shows the cause:
| #include <sys/stat.h>
| #include <sys/mman.h>
| #include <fcntl.h>
|
| int main(int argc, const char * const argv[])
| {
| struct stat st;
| lstat(argv[1], &st);
|
| int fd = open(argv[1], O_RDONLY);
| void *data = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
| void *t = memchr(data, 0, st.st_size);
| printf("ptr: %p, ret: %p, len: 0x%zx\n", data, t, st.st_size);
| return 0;
| }
Example output:
| % ./test /etc/passwd
| ptr: 0x2000000000050000, ret: 0x200000000005040e, len: 0x40e
The found location is already after the buffer. memchr is AFAIK expanded
by gcc.
Bastian
--
Where there's no emotion, there's no motive for violence.
-- Spock, "Dagger of the Mind", stardate 2715.1
Reply to: