Bug 192935 - rewinddir/seekdir/telldir changes in 10-STABLE r270002 broke some php functionality
Summary: rewinddir/seekdir/telldir changes in 10-STABLE r270002 broke some php functio...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 10.0-STABLE
Hardware: Any Any
: --- Affects Many People
Assignee: John Baldwin
URL:
Keywords:
Depends on:
Blocks: 193278
  Show dependency treegraph
 
Reported: 2014-08-22 23:01 UTC by iron.udjin
Modified: 2014-09-08 16:33 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description iron.udjin 2014-08-22 23:01:30 UTC
Hello,

After update to latest FreeBSD 10-STABLE I started experience mystic issues, for example with Symphony2 engine. Some php functions which works with files and directories start return wrong results. Later then I have started experience mystic issues with Magento engine on another server when it doesn't see config file but file definitely exist and in correct path with correct permissions. After I rolled-back from buggy r270002 to previous commit (r269986) all problems disappeared.

Sorry guys that I can't provide more info about a bug and where exactly the problem. I'm not a programmer and it's difficult for me to debug huge web-engine. Also I spend on the temporary solution a few days and terribly tired.

I use php55-5.5.15_1.

Thanks
Comment 1 Wei-Hao Syu 2014-08-25 11:12:40 UTC
same in 11-CURRENT

laravel 4 with semantic ui package

# php artisan asset:publish --path=vendor/semantic/ui/build/packaged semantic
Assets published for package: semantic

It calls php's copy() to copy files. copy() returns success but nothing copied.
Rollback /lib/libc.so.7 to r298xxx (early july) and everything works fine.
Comment 2 Jilles Tjoelker freebsd_committer 2014-08-26 21:47:09 UTC
Adding CC committer and reviewer.

In 11-current, this change was split up in three commits: r268531, r269079, r269204. Can you determine which one causes the problem?
Comment 3 Wei-Hao Syu 2014-08-27 16:28:07 UTC
tested in 11-CURRENT

r268467 ok
r268531 failed
r269079 failed
r269204 failed

so I think it's r268531
Comment 4 John Baldwin freebsd_committer freebsd_triage 2014-08-27 21:07:22 UTC
Are you using unionfs?  (Trying to narrow it down is all, I doubt you are using it)
Comment 5 Wei-Hao Syu 2014-08-28 11:17:46 UTC
No, I'm not using unionfs.

btw, I found actually it's not copy's fault.
FilesystemInterator lists nothing so nothing copied, and no error returned.

sample code for testing: (php 5.5.15 cli)
<?php
$files = new FilesystemIterator('/etc');
foreach ($files as $file) {
  echo $file->getFilename() . "\n";
}
Comment 6 commit-hook freebsd_committer 2014-09-03 19:01:48 UTC
A commit references this bug:

Author: jhb
Date: Wed Sep  3 19:01:34 UTC 2014
New revision: 271048
URL: http://svnweb.freebsd.org/changeset/base/271048

Log:
  Always seek back to the beginning of a regular directory, even if the
  previous seek location was 0.  Without this, readdir() would see
  dd_loc of zero and call getdirentries() which would start reading
  entries at the current seek location of the directory ignoring the
  first batch of entries.  Also, rewinddir() should always seek so that
  it reads the directory from the beginning to get updated entries.

  PR:		192935
  Reported by:	iron@mail.ua
  MFC after:	3 days

Changes:
  head/lib/libc/gen/rewinddir.c
Comment 7 John Baldwin freebsd_committer freebsd_triage 2014-09-03 19:03:25 UTC
Thank you for the relatively simple test case.  I was able to reproduce and identify the root cause.  The fix has been committed to HEAD and I will merge it to stable/10 soon.  Please test the fix out on your end as well.
Comment 8 Martin Matuska freebsd_committer 2014-09-03 19:46:10 UTC
I confirm that that merging 271048 to 10-STABLE fixes the issue.
Comment 9 iron.udjin 2014-09-04 00:43:24 UTC
Thank you very much. Patch fixes the problem. Waiting for MFC to 10-STABLE.
Comment 10 Wei-Hao Syu 2014-09-04 17:14:09 UTC
It works, this issue is fixed, thank you!
Comment 11 commit-hook freebsd_committer 2014-09-08 14:46:16 UTC
A commit references this bug:

Author: jhb
Date: Mon Sep  8 14:45:58 UTC 2014
New revision: 271263
URL: http://svnweb.freebsd.org/changeset/base/271263

Log:
  MFC 271048:
  Always seek back to the beginning of a regular directory, even if the
  previous seek location was 0.  Without this, readdir() would see
  dd_loc of zero and call getdirentries() which would start reading
  entries at the current seek location of the directory ignoring the
  first batch of entries.  Also, rewinddir() should always seek so that
  it reads the directory from the beginning to get updated entries.

  PR:		192935
  Approved by:	re (gjb)

Changes:
_U  stable/10/
  stable/10/lib/libc/gen/rewinddir.c