[Bug 209742] devel/godot: Improve port (v2.0.3); add devel/godot-tools port

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Jul 2 12:30:22 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209742

lightside <lightside at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #172034|maintainer-approval?(FreeBS |
              Flags|D at ShaneWare.Biz)            |
 Attachment #172034|0                           |1
        is obsolete|                            |
 Attachment #172038|                            |maintainer-approval?(FreeBS
              Flags|                            |D at ShaneWare.Biz)

--- Comment #42 from lightside <lightside at gmx.com> ---
Created attachment 172038
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=172038&action=edit
Proposed patch (since 415742 revision)

(In reply to comment #41)
> I don't see the need for the extra if() - To include the extra WARN_PRINT
> add it after if(sysctl()!=0) when you set the string to zero length, as you
> setting the string to zero length there would be no point in creating the
> String and testing if it equals ""
I guess, the check for empty string might be needed, in case sysctl returns
empty string (not sure, if this is possible, but still), like in Linux case for
readlink. This is two exception cases, which were combined into one WARN_PRINT.
The "buf[0] = '\0';" is similar to Linux case with "memset(buf,0,256);"

But from the code of vn_fullpath1 function, it assigns '\0' to last buf(fer)
position:
https://github.com/freebsd/freebsd/blob/28823d06561e2e9911180b17a57e05ff19d7cbf6/sys/kern/vfs_cache.c#L1303
So it should be ok without manual assign.

You could check various examples on the following search request:
https://github.com/freebsd/freebsd/search?q=KERN_PROC_PATHNAME

The source code for sysctl_kern_proc_pathname function is here, for reference:
https://github.com/freebsd/freebsd/blob/736e07849585def123cc8c3042c05c77f3d11e2e/sys/kern/kern_proc.c#L1995

Particularly, there is even "/proc/curproc/file" example (for readlink usage,
instead of "/proc/self/exe", like in Linux case):
https://github.com/freebsd/freebsd/blob/bb4ff000de429abf7115b8d078833c468387f1dd/contrib/libexecinfo/backtrace.c#L55
which works, but returns warnings several times, if used similarly as for Linux
case.

But there is explicit differentiation in compiler-rt source code (sysctl for
FreeBSD and readlink for others):
https://github.com/freebsd/freebsd/blob/9c27ec33f2c82fe6c60c9c375a88f96a1e10a6a2/contrib/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc#L715

In case of pathname request for other process, there is an example with check
for "len == 0 || strlen(pathname) == 0" and "No cached pathname for process"
error:
https://github.com/freebsd/freebsd/blob/290f0204ae95d6dc92ba9c15fafe090e9d4338af/tools/test/ptrace/scescx.c#L170

New patch attached, with your suggestion.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list