[Puppet - Bug #2675] (Unreviewed) ending slash in directory name gets stripped off

3 views
Skip to first unread message

red...@reductivelabs.com

unread,
Sep 24, 2009, 3:40:03 AM9/24/09
to ja...@lovedthanlost.net, and...@reductivelabs.com, peter...@immerda.ch, ha...@usg.edu, la...@reductivelabs.com, r...@devco.net, marc.f...@camptocamp.com, puppe...@googlegroups.com
Issue #2675 has been reported by Marc Fournier.

Bug #2675: ending slash in directory name gets stripped off

  • Author: Marc Fournier
  • Status: Unreviewed
  • Priority: High
  • Assigned to:
  • Category: file
  • Target version: 0.25.1
  • Affected version: 0.25.1rc1
  • Keywords:
  • Branch:

I just noticed this error on 0.25.x. It used to work on 0.24.8.

$ cat /tmp/test1.pp
file { "/tmp/dir1":       ensure => directory }
file { "/tmp/dir1/file1": ensure => present, require => File["/tmp/dir1"] }

$ cat /tmp/test2.pp
file { "/tmp/dir2/":      ensure => directory }
file { "/tmp/dir2/file2": ensure => present, require => File["/tmp/dir2"] }

$ cat /tmp/test3.pp
file { "/tmp/dir3/":      ensure => directory }
file { "/tmp/dir3/file3": ensure => present, require => File["/tmp/dir3/"] }

$ puppet /tmp/test1.pp
notice: //File[/tmp/dir1]/ensure: created
notice: //File[/tmp/dir1/file1]/ensure: created

$ puppet /tmp/test2.pp
notice: //File[/tmp/dir2]/ensure: created
notice: //File[/tmp/dir2/file2]/ensure: created

$ puppet /tmp/test3.pp
Could not find dependency File[/tmp/dir3/] for File[/tmp/dir3/file3] at /tmp/test3.pp:2

I think I have a working patch. I'll submit it in a few minutes.


You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://reductivelabs.com/redmine/my/account

red...@reductivelabs.com

unread,
Sep 24, 2009, 4:18:17 AM9/24/09
to ja...@lovedthanlost.net, and...@reductivelabs.com, peter...@immerda.ch, ha...@usg.edu, la...@reductivelabs.com, r...@devco.net, marc.f...@camptocamp.com, puppe...@googlegroups.com
Issue #2675 has been updated by Marc Fournier.
  • File 0001-Fix-2675-re-add-ending-slash-to-directory-names.patch added

This bug was introduced in commit cc09c1af. Using File.split on a filename ending with a slash drops this ending slash. A resource name ending with a slash gets silently "renamed" and this breaks the dependencies.

red...@reductivelabs.com

unread,
Sep 24, 2009, 7:09:38 AM9/24/09
to ja...@lovedthanlost.net, and...@reductivelabs.com, ha...@usg.edu, la...@reductivelabs.com, r...@devco.net, marc.f...@camptocamp.com, lu...@madstop.com, puppe...@googlegroups.com
Issue #2675 has been updated by James Turnbull.
  • Status changed from Unreviewed to Needs design decision
  • Assigned to set to Luke Kanies
  • Author: Marc Fournier
  • Status: Needs design decision
  • Priority: High
  • Assigned to: Luke Kanies

red...@reductivelabs.com

unread,
Sep 24, 2009, 2:30:00 PM9/24/09
to ja...@lovedthanlost.net, and...@reductivelabs.com, ha...@usg.edu, la...@reductivelabs.com, r...@devco.net, marc.f...@camptocamp.com, puppe...@googlegroups.com
Issue #2675 has been updated by Luke Kanies.

This is kind of the inverse of #1042, and I think it has the right approach.

Really, the correct approach is that the / shouldn't have an affect either way -- I absolutely despise the way tools like cp behave differently depending on whether there's a trailing slash.

I.e., I think this is a duplicate of #1042, and this patch will only work to the extent that you know exactly whether the file has a trailing slash.

  • Author: Marc Fournier
  • Status: Needs design decision
  • Priority: High
  • Assigned to: Luke Kanies

red...@reductivelabs.com

unread,
Oct 7, 2009, 7:59:52 PM10/7/09
to ja...@lovedthanlost.net, and...@reductivelabs.com, la...@reductivelabs.com, r...@devco.net, marc.f...@camptocamp.com, puppe...@googlegroups.com
Issue #2675 has been updated by Luke Kanies.
  • Status changed from Needs design decision to Duplicate

I'm closing this as a dupe of #1042, since they really are the same problem.

This is actually a pretty hard problem to fix, and a very easy problem to work around, so I don't think it qualifies as High priority.

  • Author: Marc Fournier
  • Status: Duplicate
  • Priority: High
  • Assigned to: Luke Kanies

red...@reductivelabs.com

unread,
Oct 19, 2009, 11:44:34 AM10/19/09
to ja...@lovedthanlost.net, and...@reductivelabs.com, la...@reductivelabs.com, r...@devco.net, marc.f...@camptocamp.com, lu...@madstop.com, puppe...@googlegroups.com
Issue #2675 has been updated by Marc Fournier.
  • Status changed from Duplicate to Re-opened
  • Priority changed from High to Low
  • Affected version changed from 0.25.1rc1 to 0.25.1rc2

Sorry for reopening this bug. I would like to draw attention to this thread: http://groups.google.com/group/puppet-dev/browse_thread/thread/d36450a5747be593/25d9edad436dbe51?lnk=gst&q=2675

Maybe the solution is just that people fix their manifests with file resources ending with a slash. In this case this issue indeed is a duplicate of #1042. If not, it deserves to stay open as a reminder.

  • Author: Marc Fournier
  • Status: Re-opened
  • Priority: Low
  • Assigned to: Luke Kanies
  • Category: file
  • Target version: 0.25.1
  • Affected version: 0.25.1rc2
  • Keywords:
  • Branch:

red...@reductivelabs.com

unread,
Oct 27, 2009, 1:49:05 AM10/27/09
to ja...@lovedthanlost.net, la...@reductivelabs.com, r...@devco.net, marc.f...@camptocamp.com, lu...@madstop.com, puppe...@googlegroups.com
Issue #2675 has been updated by James Turnbull.
  • Target version changed from 0.25.1 to 0.25.2
  • Author: Marc Fournier
  • Status: Re-opened
  • Priority: Low
  • Assigned to: Luke Kanies
  • Category: file
  • Target version: 0.25.2
  • Affected version: 0.25.1rc2
  • Keywords:
  • Branch:

red...@reductivelabs.com

unread,
Oct 27, 2009, 2:14:16 AM10/27/09
to ja...@lovedthanlost.net, la...@reductivelabs.com, r...@devco.net, marc.f...@camptocamp.com, lu...@madstop.com, puppe...@googlegroups.com
  • Author: Marc Fournier
  • Status: Re-opened
  • Priority: Low
  • Assigned to: Luke Kanies
  • Category: file
  • Target version: 0.25.2
  • Affected version: 0.25.1rc2
  • Keywords:

red...@reductivelabs.com

unread,
Oct 30, 2009, 4:45:07 PM10/30/09
to ja...@lovedthanlost.net, la...@reductivelabs.com, r...@devco.net, marc.f...@camptocamp.com, Mar...@reality.com, puppe...@googlegroups.com
Issue #2675 has been updated by Markus Roberts.
  • Status changed from Re-opened to Code Insufficient
  • Assigned to changed from Luke Kanies to Markus Roberts

No one (including me) was thrilled with the rush patch intended for 0.25.1, so I've got another, more general/cleaner solution in the queue (coming soen).

  • Author: Marc Fournier
  • Status: Code Insufficient
  • Priority: Low
  • Assigned to: Markus Roberts

    I just noticed this error on 0.25.x. It used to work on 0.24.8.

    red...@reductivelabs.com

    unread,
    Nov 2, 2009, 9:15:06 PM11/2/09
    to ja...@lovedthanlost.net, la...@reductivelabs.com, r...@devco.net, marc.f...@camptocamp.com, Mar...@reality.com, puppe...@googlegroups.com
    Issue #2675 has been updated by Markus Roberts.

    New branch, rebased off of 0.25.1 and restructured as per discussions, making parameters (rather than types) responsible for value canonicalization.

    • Author: Marc Fournier

      I just noticed this error on 0.25.x. It used to work on 0.24.8.

      red...@reductivelabs.com

      unread,
      Nov 2, 2009, 10:08:10 PM11/2/09
      to ja...@lovedthanlost.net, la...@reductivelabs.com, r...@devco.net, marc.f...@camptocamp.com, Mar...@reality.com, puppe...@googlegroups.com
      Issue #2675 has been updated by Markus Roberts.
      • Status changed from Code Insufficient to Ready for Testing
      • Author: Marc Fournier
      • Status: Ready for Testing

        I just noticed this error on 0.25.x. It used to work on 0.24.8.

        red...@reductivelabs.com

        unread,
        Nov 11, 2009, 6:26:19 PM11/11/09
        to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, Mar...@reality.com, puppe...@googlegroups.com
        Issue #2675 has been updated by Markus Roberts.
        • Status changed from Ready for Testing to Ready for Checkin

        I just updated (rebased) the branch & ported the key potentially conflicting change (m flag on the regexp) from #2770 to simplify the eventual merge conflict.

        • Author: Marc Fournier
        • Status: Ready for Checkin

          I just noticed this error on 0.25.x. It used to work on 0.24.8.

          red...@reductivelabs.com

          unread,
          Nov 12, 2009, 5:21:15 AM11/12/09
          to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, Mar...@reality.com, puppe...@googlegroups.com
          Issue #2675 has been updated by James Turnbull.
          • Status changed from Ready for Checkin to Code Insufficient

          This doesn't apply to 0.25.x cleanly.

          • Author: Marc Fournier
          • Status: Code Insufficient

            I just noticed this error on 0.25.x. It used to work on 0.24.8.

            red...@reductivelabs.com

            unread,
            Nov 12, 2009, 3:07:53 PM11/12/09
            to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, Mar...@reality.com, puppe...@googlegroups.com
            • Author: Marc Fournier
            • Status: Code Insufficient
            • Priority: Low
            • Assigned to: Markus Roberts
            • Category: file
            • Target version: 0.25.2
            • Affected version: 0.25.1rc2
            • Keywords:

            red...@reductivelabs.com

            unread,
            Nov 12, 2009, 4:31:08 PM11/12/09
            to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, Mar...@reality.com, puppe...@googlegroups.com
            Issue #2675 has been updated by James Turnbull.

            Still no go.

            Auto-merged lib/puppet/resource/catalog.rb
            Auto-merged lib/puppet/resource/reference.rb
            CONFLICT (content): Merge conflict in lib/puppet/resource/reference.rb
            Automatic cherry-pick failed.  After resolving the conflicts,
            mark the corrected paths with 'git add <paths>' or 'git rm <paths>' and commit the result.
            When commiting, use the option '-c f3e48f9' to retain authorship and message.
            
            • Author: Marc Fournier

              I just noticed this error on 0.25.x. It used to work on 0.24.8.

              red...@reductivelabs.com

              unread,
              Nov 13, 2009, 1:15:56 PM11/13/09
              to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, Mar...@reality.com, puppe...@googlegroups.com
              Issue #2675 has been updated by Markus Roberts.

              This wasn't a rebasing problem, it was the expected conflict with #2770. Fixed now.

              • Author: Marc Fournier

                I just noticed this error on 0.25.x. It used to work on 0.24.8.

                red...@reductivelabs.com

                unread,
                Nov 13, 2009, 1:16:07 PM11/13/09
                to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, Mar...@reality.com, puppe...@googlegroups.com
                Issue #2675 has been updated by Markus Roberts.
                • Status changed from Code Insufficient to Ready for Checkin
                • Author: Marc Fournier
                • Status: Ready for Checkin

                  I just noticed this error on 0.25.x. It used to work on 0.24.8.

                  red...@reductivelabs.com

                  unread,
                  Nov 13, 2009, 5:09:33 PM11/13/09
                  to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, Mar...@reality.com, puppe...@googlegroups.com
                  Issue #2675 has been updated by James Turnbull.
                  • Status changed from Ready for Checkin to Closed

                  Pushed in commit:"ca56aa7e5849a5489e8d38e29b25ea934caafcd7" in branch 0.25.x

                  • Author: Marc Fournier
                  • Status: Closed

                    I just noticed this error on 0.25.x. It used to work on 0.24.8.

                    red...@reductivelabs.com

                    unread,
                    Dec 28, 2009, 1:08:42 PM12/28/09
                    to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, Mar...@reality.com, puppe...@googlegroups.com
                    Issue #2675 has been updated by Marc Fournier.
                    • Status changed from Closed to Re-opened

                    I just tried to update my puppetmaster to 0.25.2rc2, and another variant of
                    this bug resurfaced. Now every client, even those < 0.25, fail with this
                    error:

                    info: Retrieving plugins
                    info: Retrieving facts
                    err: Could not retrieve catalog: Could not find resource File[/etc/pki/] when converting to resource resources on node host.example.com
                    [...]
                    

                    The resource triggering the error is quite simple:

                    file { ["/etc/pki/", "/etc/pki/rpm-gpg/"]:
                      ensure => directory,
                    }
                    

                    Rewriting it like this solves the problem:

                    file { ["/etc/pki", "/etc/pki/rpm-gpg"]:
                      ensure => directory,
                    }
                    

                    As I have dozens of resources ending with a slash, my initial question was:
                    should people edit every "file" resource ending with a slash and stripping
                    it off ? Or should puppet treat File["/etc/pki"] and File["/etc/pki/"] as
                    the same ?

                    Using the 3 demo files described in the inital report can be used to
                    reproduce the error:

                    $ puppet test1.pp 
                    notice: //File[/tmp/dir1]/ensure: created
                    notice: //File[/tmp/dir1/file1]/ensure: created
                    
                    $ puppet test2.pp 
                    Could not find resource File[/tmp/dir2/] when converting to resource resources on node host.example.com
                    
                    $ puppet test3.pp 
                    Could not find resource File[/tmp/dir3/] when converting to resource resources on node host.example.com
                    

                    • Author: Marc Fournier
                    • Status: Re-opened

                      I just noticed this error on 0.25.x. It used to work on 0.24.8.

                      red...@reductivelabs.com

                      unread,
                      Dec 30, 2009, 3:33:17 PM12/30/09
                      to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, Mar...@reality.com, puppe...@googlegroups.com
                      Issue #2675 has been updated by Markus Roberts.
                      • Status changed from Re-opened to Investigating
                      • Author: Marc Fournier
                      • Status: Investigating

                        I just noticed this error on 0.25.x. It used to work on 0.24.8.

                        red...@reductivelabs.com

                        unread,
                        Dec 31, 2009, 12:26:36 AM12/31/09
                        to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, jes...@gmail.com, puppe...@googlegroups.com
                        Issue #2675 has been updated by Jesse Wolfe.

                        There was an intermittent bug in Puppet::Parser::Resource::Reference,
                        during initialization, and object could sometimes have its title set
                        before its type is set. This prevented the title from going through
                        type-specific canonicalization.

                        • Author: Marc Fournier
                        • Status: Ready for Testing
                        • Priority: Low
                        • Assigned to: Jesse Wolfe
                        • Category: file
                        • Target version: 0.25.2
                        • Affected version: 0.25.1rc2
                        • Keywords:

                        red...@reductivelabs.com

                        unread,
                        Dec 31, 2009, 7:31:45 PM12/31/09
                        to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, puppe...@googlegroups.com
                        Issue #2675 has been updated by James Turnbull.
                        • Assigned to changed from Jesse Wolfe to Marc Fournier

                        Marc - can you confirm so we can merge and release please! Thanks!

                        • Author: Marc Fournier
                        • Status: Ready for Testing
                        • Priority: Low
                        • Assigned to: Marc Fournier

                          I just noticed this error on 0.25.x. It used to work on 0.24.8.

                          red...@reductivelabs.com

                          unread,
                          Dec 31, 2009, 7:45:26 PM12/31/09
                          to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, puppe...@googlegroups.com
                          Issue #2675 has been updated by Markus Roberts.
                          • Status changed from Ready for Testing to Ready for Checkin

                          This was also biting us as a test indeterminacy.

                          • Author: Marc Fournier
                          • Status: Ready for Checkin

                            I just noticed this error on 0.25.x. It used to work on 0.24.8.

                            red...@reductivelabs.com

                            unread,
                            Dec 31, 2009, 7:57:28 PM12/31/09
                            to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, puppe...@googlegroups.com
                            Issue #2675 has been updated by James Turnbull.
                            • Status changed from Ready for Checkin to Closed

                            Pushed in commit:"13cbf043c6e16c14b0ab9fccd5738a8c9e5925b3" in branch 0.25.x

                            • Author: Marc Fournier
                            • Status: Closed

                              I just noticed this error on 0.25.x. It used to work on 0.24.8.

                              red...@reductivelabs.com

                              unread,
                              Jan 2, 2010, 8:47:20 PM1/2/10
                              to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, puppe...@googlegroups.com
                              Issue #2675 has been updated by Jeroen Meeuwen.
                              • Status changed from Closed to Re-opened

                              A trailing slash in a File resource is still being stripped off. I found a working workaround to be to not strip off the trailing slash.

                              http://git.ogd.nl/people?p=jeroenm2/public_git/puppet.git;a=commitdiff;h=524e85160c275effaf8a5550dbb0c22a0fa1e651 (or remote http://git.ogd.nl/~jeroenm2/puppet.git, branch 'tickets/2675'

                              • Author: Marc Fournier
                              • Status: Re-opened

                                I just noticed this error on 0.25.x. It used to work on 0.24.8.

                                red...@reductivelabs.com

                                unread,
                                Jan 2, 2010, 9:45:46 PM1/2/10
                                to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, puppe...@googlegroups.com
                                Issue #2675 has been updated by Markus Roberts.
                                • Subject changed from ending slash in directory name gets stripped off to File path comparisons sensitive to trailing slashes
                                • Status changed from Re-opened to Needs more information
                                • Assigned to deleted (Marc Fournier)

                                I'm unclear on what that patch is supposed to accomplish; it appears that it would simply reintroduce the bug, by making "/some/path/" and "/some/path" be internally distinct when they are not supposed to be.


                                Bug #2675: File path comparisons sensitive to trailing slashes

                                • Author: Marc Fournier
                                • Status: Needs more information
                                • Priority: Low
                                • Assigned to:
                                • Category: file

                                  I just noticed this error on 0.25.x. It used to work on 0.24.8.

                                  red...@reductivelabs.com

                                  unread,
                                  Jan 4, 2010, 9:01:54 PM1/4/10
                                  to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, puppe...@googlegroups.com
                                  Issue #2675 has been updated by James Turnbull.
                                  • Target version changed from Puppet - 0.25.2 to Puppet - 0.25.3

                                  Bumping this and discussion - my inclination is to what for feedback before closing though.

                                  • Author: Marc Fournier
                                  • Status: Needs more information
                                  • Priority: Low
                                  • Assigned to:
                                  • Category: file
                                  • Target version: 0.25.3

                                  red...@reductivelabs.com

                                  unread,
                                  Jan 5, 2010, 12:16:13 PM1/5/10
                                  to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, puppe...@googlegroups.com
                                  Issue #2675 has been updated by Jeroen Meeuwen.

                                  Markus Roberts wrote:

                                  I'm unclear on what that patch is supposed to accomplish; it appears that it would simply reintroduce the bug, by making "/some/path/" and "/some/path" be internally distinct when they are not supposed to be.

                                  The former solution provided to the problem as you state it though, is not allowing to use a trailing slash in a directory path at all. Usually though, directory paths do have a trailing slash (documentation, even freaking tab completion, etc. and thus why not puppet manifests also)?

                                  The use of this trailing slash is to be able to significantly distinct between a file and a directory path when using dependencies; the 'require => File["/some/path/"]' may be somewhere other then the 'file { "/some/path/": ensure => directory }'.

                                  I'd say that reintroducing the original "bug" where File["/some/path/"] and File["/some/path"] are not the same while they should be, is irrelevant if you consider the solution provided in 0.25.x is eliminating the possibility to conform to very common standards, and therefore actually preventing stuff from happening.

                                  red...@reductivelabs.com

                                  unread,
                                  Jan 5, 2010, 12:30:34 PM1/5/10
                                  to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, puppe...@googlegroups.com
                                  Issue #2675 has been updated by Jeroen Meeuwen.

                                  Is it reasonable to look at lib/puppet/type/file/ensure.rb to mangle/canonicalize (or alias?) file/link/directory paths, rather then not allowing trailing slashes to all paths for all types of ensure?

                                  red...@reductivelabs.com

                                  unread,
                                  Jan 5, 2010, 1:15:19 PM1/5/10
                                  to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, puppe...@googlegroups.com
                                  Issue #2675 has been updated by Jeroen Meeuwen.
                                  • Status changed from Needs more information to Closed

                                  Mysteriously (or not so mysteriously) upgrading both the server and the client to the 0.25.2 release solved all my problems. It seems I was under the mistaken impression that trailing slashes could no longer be used as that was what I thought my error messages indicated not finding resource dependencies anymore I now understand how that would not have made any sense. Apologies to all!

                                  • Author: Marc Fournier
                                  • Status: Closed

                                  red...@reductivelabs.com

                                  unread,
                                  Jan 8, 2010, 2:08:44 AM1/8/10
                                  to ja...@lovedthanlost.net, r...@devco.net, marc.f...@camptocamp.com, puppe...@googlegroups.com
                                  Issue #2675 has been updated by James Turnbull.
                                  • Target version deleted (Puppet - 0.25.3)
                                  • Author: Marc Fournier
                                  • Status: Closed
                                  • Priority: Low
                                  • Assigned to:
                                  • Category: file
                                  • Target version:
                                  Reply all
                                  Reply to author
                                  Forward
                                  0 new messages