Loading ...
Sorry, an error occurred while loading the content.

Re: Patch 6.1.148 (extra)

Expand Messages
  • MURAOKA Taro
    ... I m using gvim on W2K with NTFS. After applied this patch, filewritable() never return 2 for a directory. ... Please check it. ... MURAOKA Taro
    Message 1 of 6 , Aug 5 3:26 AM
    • 0 Attachment
      > Patch 6.1.148 (extra)
      > Problem: MS-Windows: ACL is not properly supported.
      > Solution: Add an access() replacement that also works for ACL. (Mike
      > Williams)
      > Files: runtime/doc/editing.txt, src/os_win32.c

      I'm using gvim on W2K with NTFS.
      After applied this patch, filewritable() never return 2 for a directory.
      It will be reproduced by:
      :echo filewritable($VIM)
      Please check it.
      ----
      MURAOKA Taro <koron@...>
    • Bram Moolenaar
      ... Thanks for reporting this. Mike, can this be fixed? -- hundred-and-one symptoms of being an internet addict: 102. When filling out your driver s license
      Message 2 of 6 , Aug 5 4:55 AM
      • 0 Attachment
        Muraoka Taro wrote:

        > > Patch 6.1.148 (extra)
        > > Problem: MS-Windows: ACL is not properly supported.
        > > Solution: Add an access() replacement that also works for ACL. (Mike
        > > Williams)
        > > Files: runtime/doc/editing.txt, src/os_win32.c
        >
        > I'm using gvim on W2K with NTFS.
        > After applied this patch, filewritable() never return 2 for a directory.
        > It will be reproduced by:
        > :echo filewritable($VIM)
        > Please check it.

        Thanks for reporting this. Mike, can this be fixed?

        --
        hundred-and-one symptoms of being an internet addict:
        102. When filling out your driver's license application, you give
        your IP address.

        /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
        /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\
        \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
        \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
      • Mike Williams
        I ll look into it - may be a while due to other commitments. ... Mike -- The last bug is out of your product when your last user dies.
        Message 3 of 6 , Aug 5 7:00 AM
        • 0 Attachment
          I'll look into it - may be a while due to other commitments.

          On 5 Aug 2002 at 13:55, Bram Moolenaar wrote:

          > Muraoka Taro wrote:
          >
          > > > Patch 6.1.148 (extra)
          > > > Problem: MS-Windows: ACL is not properly supported.
          > > > Solution: Add an access() replacement that also works for ACL. (Mike
          > > > Williams)
          > > > Files: runtime/doc/editing.txt, src/os_win32.c
          > >
          > > I'm using gvim on W2K with NTFS.
          > > After applied this patch, filewritable() never return 2 for a directory.
          > > It will be reproduced by:
          > > :echo filewritable($VIM)
          > > Please check it.
          >
          > Thanks for reporting this. Mike, can this be fixed?
          >
          > --
          > hundred-and-one symptoms of being an internet addict:
          > 102. When filling out your driver's license application, you give
          > your IP address.
          >
          > /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
          > /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\
          > \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
          > \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///

          Mike
          --
          The last bug is out of your product when your last user dies.
        • Glenn Maynard
          ... CreateFile isn t good with directories. How about something like this: if(mch_isdir(n)) { int ret = 0; if(p & R_OK) { char TempDir[_MAX_PATH+16] = ;
          Message 4 of 6 , Aug 5 10:04 AM
          • 0 Attachment
            On Mon, Aug 05, 2002 at 01:55:36PM +0200, Bram Moolenaar wrote:
            > > I'm using gvim on W2K with NTFS.
            > > After applied this patch, filewritable() never return 2 for a directory.
            > > It will be reproduced by:
            > > :echo filewritable($VIM)
            > > Please check it.
            >
            > Thanks for reporting this. Mike, can this be fixed?

            CreateFile isn't good with directories. How about something like this:

            if(mch_isdir(n)) {
            int ret = 0;
            if(p & R_OK) {
            char TempDir[_MAX_PATH+16] = "";
            WIN32_FIND_DATA d;

            strncpy(TempDir, n, _MAX_PATH);
            if(!strchr("/\\", TempDir[strlen(TempDir)-1]))
            strncat(TempDir, "\\", _MAX_PATH);
            strncat(TempDir, "*", _MAX_PATH);

            if(FindFirstFile(n, &d) == INVALID_HANDLE_VALUE)
            ret = -1;
            }

            if(ret == 0 && (p & W_OK)) {
            char TempFile[_MAX_PATH+1];
            if (GetTempFileName(n, "VIM", 0, TempFile))
            mch_remove((char_u *) TempFile);
            else
            ret = -1;
            }
            return ret;
            }

            (No patch, because my vim_access() also has mbyte support added.)

            --
            Glenn Maynard
          • Mike Williams
            ... Yup - hadn t realised it was also used for filewritable() on directories. The whole area is a mess due to ACLs (not working on Samba) and read-only
            Message 5 of 6 , Aug 6 3:19 AM
            • 0 Attachment
              On 5 Aug 2002 at 13:04, Glenn Maynard wrote:

              > On Mon, Aug 05, 2002 at 01:55:36PM +0200, Bram Moolenaar wrote:
              > > > I'm using gvim on W2K with NTFS.
              > > > After applied this patch, filewritable() never return 2 for a directory.
              > > > It will be reproduced by:
              > > > :echo filewritable($VIM)
              > > > Please check it.
              > >
              > > Thanks for reporting this. Mike, can this be fixed?
              >
              > CreateFile isn't good with directories.

              Yup - hadn't realised it was also used for filewritable() on
              directories. The whole area is a mess due to ACLs (not working on
              Samba) and read-only shares.

              > How about something like this:
              >
              > if(mch_isdir(n)) {
              > int ret = 0;
              > if(p & R_OK) {
              > char TempDir[_MAX_PATH+16] = "";
              > WIN32_FIND_DATA d;
              >
              > strncpy(TempDir, n, _MAX_PATH);
              > if(!strchr("/\\", TempDir[strlen(TempDir)-1]))
              > strncat(TempDir, "\\", _MAX_PATH);
              > strncat(TempDir, "*", _MAX_PATH);
              >
              > if(FindFirstFile(n, &d) == INVALID_HANDLE_VALUE)
              > ret = -1;
              > }
              >
              > if(ret == 0 && (p & W_OK)) {
              > char TempFile[_MAX_PATH+1];
              > if (GetTempFileName(n, "VIM", 0, TempFile))
              > mch_remove((char_u *) TempFile);
              > else
              > ret = -1;
              > }
              > return ret;
              > }

              Looks a goer. Need to have a play with it with some ACL settings -
              can't remember if you can create a file in a directory but not delete
              it which could be a pain.

              Mike
              --
              The only thing blue movies leave to the imagination is the plot!
            • Mike Williams
              Hi, I have now had a chance to investigate this a bit more. The approach suggested by Glenn works apart from one set of ACL settings where the directory s ACL
              Message 6 of 6 , Aug 13 2:06 AM
              • 0 Attachment
                Hi,

                I have now had a chance to investigate this a bit more. The approach
                suggested by Glenn works apart from one set of ACL settings where the
                directory's ACL allows the user to create files but is denied
                deleting them. The check for a writable directory will leave empty
                files lying around since mch_remove() fails - which may not be nice.
                Of course, the solution would be add a proper ACL check - hang on,
                isn't that where we started with all this? ;-)

                I'll have to root around for the previous ACL checking code I
                submitted with the Samba checks in it, and and an ACL check before
                attempting to create the temporary file (still need to do this since
                this catches read-only shares). Later this week hopefully.

                Ah, found a bug! Set the read-only flag on a directory and do :echo
                filewritable(...) on it - you get a value of 0 but you can in fact
                write files to the directory. The read-only attribute just adds a
                level or protection against accidental renaming or deletion. This is
                under W2K but I assume other Win/NT versions are the same. The
                simplest fix is to modify mch_writable() to always return true for a
                directory.

                One final thing (well done if you are still reading this) - why
                doesn't filereadable() work for directories like filewritable does?

                TTFN

                On 5 Aug 2002 at 13:04, Glenn Maynard wrote:

                > On Mon, Aug 05, 2002 at 01:55:36PM +0200, Bram Moolenaar wrote:
                > > > I'm using gvim on W2K with NTFS.
                > > > After applied this patch, filewritable() never return 2 for a directory.
                > > > It will be reproduced by:
                > > > :echo filewritable($VIM)
                > > > Please check it.
                > >
                > > Thanks for reporting this. Mike, can this be fixed?
                >
                > CreateFile isn't good with directories. How about something like this:
                >
                > if(mch_isdir(n)) {
                > int ret = 0;
                > if(p & R_OK) {
                > char TempDir[_MAX_PATH+16] = "";
                > WIN32_FIND_DATA d;
                >
                > strncpy(TempDir, n, _MAX_PATH);
                > if(!strchr("/\\", TempDir[strlen(TempDir)-1]))
                > strncat(TempDir, "\\", _MAX_PATH);
                > strncat(TempDir, "*", _MAX_PATH);
                >
                > if(FindFirstFile(n, &d) == INVALID_HANDLE_VALUE)
                > ret = -1;
                > }
                >
                > if(ret == 0 && (p & W_OK)) {
                > char TempFile[_MAX_PATH+1];
                > if (GetTempFileName(n, "VIM", 0, TempFile))
                > mch_remove((char_u *) TempFile);
                > else
                > ret = -1;
                > }
                > return ret;
                > }
                >
                > (No patch, because my vim_access() also has mbyte support added.)
                >
                > --
                > Glenn Maynard

                Mike
                --
                I've got to start listening to those quiet, nagging doubts.
              Your message has been successfully submitted and would be delivered to recipients shortly.