Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XrdSysFAttrBsd.icc patch #791

Closed
yurivict opened this issue Aug 1, 2018 · 4 comments
Closed

XrdSysFAttrBsd.icc patch #791

yurivict opened this issue Aug 1, 2018 · 4 comments

Comments

@yurivict
Copy link
Contributor

yurivict commented Aug 1, 2018

I had to apply this patch in order to build on FreeBSD (compiler is clang-6).
Problems corrected by the patch:

  1. Missing ":"
  2. Missing ","
  3. Missing "name" argument
-- src/XrdSys/XrdSysFAttrBsd.icc.orig  2018-08-01 05:55:51 UTC
+++ src/XrdSys/XrdSysFAttrBsd.icc
@@ -68,7 +68,7 @@ int XrdSysFAttr::Get(const char *Aname, 
 // Obtain the attribute.
 //
    ec = (fd < 0 ? extattr_get_file(Path,EXTATTR_NAMESPACE_USER,Aname,Aval,Avsz)
-                  extattr_get_fd(  fd,  EXTATTR_NAMESPACE_USER,Aname,Aval,Avsz));
+                : extattr_get_fd(  fd,  EXTATTR_NAMESPACE_USER,Aname,Aval,Avsz));

 // Diagnose errors. We return 0 on ENOENT to indicate no attribute.
 //
@@ -89,8 +89,8 @@ int XrdSysFAttr::List(AList **aPL, const
 // First obtain the amount of storage we will need for the whole list
 //
    *aPL = 0;
-   Tlen = (fd < 0 ? extattr_get_file(Path,EXTATTR_NAMESPACE_USER, 0, 0)
-                    extattr_list_fd(   fd,EXTATTR_NAMESPACE_USER, 0, 0));
+   Tlen = (fd < 0 ? extattr_get_file(Path,EXTATTR_NAMESPACE_USER, "", 0, 0)
+                  : extattr_list_fd(   fd,EXTATTR_NAMESPACE_USER, 0, 0));
    if (Tlen < 0)
       {if ((ec = Diagnose("list", "*", Path, errno)) == -ENOENT) ec = 0;
        return ec;
@@ -109,8 +109,8 @@ int XrdSysFAttr::List(AList **aPL, const
 // Now get the actual list. We will not recover if someone added an attribute
 // since the time we actual determined the size of the buffer we need.
 //
-   Tlen = (fd < 0 ? extattr_get_file(Path,EXTATTR_NAMESPACE_USER, Buff, Tlen)
-                    extattr_list_fd(   fd,EXTATTR_NAMESPACE_USER, Buff, Tlen));
+   Tlen = (fd < 0 ? extattr_get_file(Path,EXTATTR_NAMESPACE_USER, "", Buff, Tlen)
+                  : extattr_list_fd(   fd,EXTATTR_NAMESPACE_USER, Buff, Tlen));
    if (Tlen < 0)
       {if ((ec = Diagnose("list", "*", Path, errno)) == -ENOENT) ec = 0;
        free(Buff);
@@ -160,7 +160,7 @@ int XrdSysFAttr::Set(const char *Aname, 
 //
   if (isNew)
      {ec = (fd < 0 ? extattr_get_file(Path,EXTATTR_NAMESPACE_USER,Aname,0,0)
[yuri@yv /usr/ports/databases/xrootd/files]$ cat patch-src_XrdSys_XrdSysFAttrBsd.icc 
--- src/XrdSys/XrdSysFAttrBsd.icc.orig	2018-08-01 05:55:51 UTC
+++ src/XrdSys/XrdSysFAttrBsd.icc
@@ -68,7 +68,7 @@ int XrdSysFAttr::Get(const char *Aname, 
 // Obtain the attribute.
 //
    ec = (fd < 0 ? extattr_get_file(Path,EXTATTR_NAMESPACE_USER,Aname,Aval,Avsz)
-                  extattr_get_fd(  fd,  EXTATTR_NAMESPACE_USER,Aname,Aval,Avsz));
+                : extattr_get_fd(  fd,  EXTATTR_NAMESPACE_USER,Aname,Aval,Avsz));
 
 // Diagnose errors. We return 0 on ENOENT to indicate no attribute.
 //
@@ -89,8 +89,8 @@ int XrdSysFAttr::List(AList **aPL, const
 // First obtain the amount of storage we will need for the whole list
 //
    *aPL = 0;
-   Tlen = (fd < 0 ? extattr_get_file(Path,EXTATTR_NAMESPACE_USER, 0, 0)
-                    extattr_list_fd(   fd,EXTATTR_NAMESPACE_USER, 0, 0));
+   Tlen = (fd < 0 ? extattr_get_file(Path,EXTATTR_NAMESPACE_USER, "", 0, 0)
+                  : extattr_list_fd(   fd,EXTATTR_NAMESPACE_USER, 0, 0));
    if (Tlen < 0)
       {if ((ec = Diagnose("list", "*", Path, errno)) == -ENOENT) ec = 0;
        return ec;
@@ -109,8 +109,8 @@ int XrdSysFAttr::List(AList **aPL, const
 // Now get the actual list. We will not recover if someone added an attribute
 // since the time we actual determined the size of the buffer we need.
 //
-   Tlen = (fd < 0 ? extattr_get_file(Path,EXTATTR_NAMESPACE_USER, Buff, Tlen)
-                    extattr_list_fd(   fd,EXTATTR_NAMESPACE_USER, Buff, Tlen));
+   Tlen = (fd < 0 ? extattr_get_file(Path,EXTATTR_NAMESPACE_USER, "", Buff, Tlen)
+                  : extattr_list_fd(   fd,EXTATTR_NAMESPACE_USER, Buff, Tlen));
    if (Tlen < 0)
       {if ((ec = Diagnose("list", "*", Path, errno)) == -ENOENT) ec = 0;
        free(Buff);
@@ -160,7 +160,7 @@ int XrdSysFAttr::Set(const char *Aname, 
 //
   if (isNew)
      {ec = (fd < 0 ? extattr_get_file(Path,EXTATTR_NAMESPACE_USER,Aname,0,0)
-                   : extattr_get_fd(  fd,  EXTATTR_NAMESPACE_USER,Aname,0 0));
+                   : extattr_get_fd(  fd,  EXTATTR_NAMESPACE_USER,Aname,0,0));
       if (ec >= 0) return -EEXIST;
      }
@abh3
Copy link
Member

abh3 commented Aug 2, 2018

Thanks for the patches. These will be applied to the xrdfattr branch which will be later merged into head. This is to simplify staging the branch to mainline.

@abh3
Copy link
Member

abh3 commented Aug 2, 2018

The patches are here and will be placed in mainline for release 4.9.

@yurivict
Copy link
Contributor Author

yurivict commented Aug 2, 2018

I also have doubt about this line:

Tlen = (fd < 0 ? extattr_get_file(Path,EXTATTR_NAMESPACE_USER, "", Buff, Tlen)

It passes the empty "name" string, but it might need to be filled with the actual name, not sure.

@abh3
Copy link
Member

abh3 commented Aug 2, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants