#1893 closed defect (fixed)

[IMFS] truncate doesn't empty file

Reported by: Xiang Cui Owned by: Chris Johns
Priority: normal Milestone: 4.11
Component: fs Version: 4.11
Severity: normal Keywords:
Cc: sebastian.huber@… Blocked By:
Blocking:

Description

IMFS fails in fsrdwr test in fstests.

254 /*
255 * Truncate it to the half size, and then truncate it to len.
256 */
257 status = truncate (name01, len / 2);
258 rtems_test_assert (status == 0);
259 status = truncate (name01, len);
260 rtems_test_assert (status == 0);
261
262 /*
263 * verify the data
264 */
265 readbuf = (char *) malloc (len / 2);
266 rtems_test_assert (readbuf);
267 fd = open (name01, O_RDONLY);
268
269 rtems_test_assert (fd != -1);
270 n = read (fd, readbuf, len / 2);
271 rtems_test_assert (n == len / 2);
272 rtems_test_assert (!strncmp (databuf, readbuf, len / 2));
273
274 /*
275 * The data from len / 2 to the end should be zero
276 */
277 n = read (fd, readbuf, len / 2);
278 rtems_test_assert (n == len / 2);
279 for (i = 0; i < len / 2; i++) {
280 rtems_test_assert (readbuf[i] == 0);
281 }

status = truncate (name01, len / 2);
status = truncate (name01, len);

the data should be set zero from len/2 to len.

Change History (2)

comment:1 Changed on May 11, 2012 at 11:05:31 AM by Sebastian Huber

Resolution: fixed
Status: newclosed, sebastian.huber@embedded-brains.de

comment:2 Changed on Nov 24, 2014 at 6:58:28 PM by Gedare Bloom

Version: HEAD4.11

Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11

Note: See TracTickets for help on using tickets.