You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "sarutak (via GitHub)" <gi...@apache.org> on 2023/08/09 21:00:08 UTC

[GitHub] [incubator-opendal] sarutak opened a new pull request, #2836: feat: Add clippy rule to avoid wrong usage of tempfile crate

sarutak opened a new pull request, #2836:
URL: https://github.com/apache/incubator-opendal/pull/2836

   Related issue: #2835 
   
   I added tempfile crate in https://github.com/apache/incubator-opendal/pull/2823 .
   One pitfall is the usage of TempDir::into_path.
   According to the [API doc](https://docs.rs/tempfile/latest/tempfile/struct.TempDir.html#method.into_path), TempDir::into_path leads the corresponding temporary directory not deleted automatically.
   To avoid resource leak I proposes to add a clippy rule.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2836: feat: Add clippy rule to avoid wrong usage of tempfile crate

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #2836:
URL: https://github.com/apache/incubator-opendal/pull/2836#discussion_r1289450057


##########
clippy.toml:
##########
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+disallowed-methods = [

Review Comment:
   I prefer fix this instead of adding new clippy rules. Maybe we can call `tempfile.close()` by hand?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-opendal] sarutak commented on a diff in pull request #2836: feat: Add clippy rule to avoid wrong usage of tempfile crate

Posted by "sarutak (via GitHub)" <gi...@apache.org>.
sarutak commented on code in PR #2836:
URL: https://github.com/apache/incubator-opendal/pull/2836#discussion_r1289587495


##########
clippy.toml:
##########
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+disallowed-methods = [

Review Comment:
   I think it's difficult to change the behavior of `TempDir::into_path` because it's not a bug. It's a specification.
   We can delete manually by `fs::remove_dir_all` (`tempfile.close` doesn't delete once `TempDir::into_path` is called) but my concern is the case someone can forget to delete by hand.
   If someone don't know the behavior of `TempDir::into_path`, it can happen.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2836: feat: Add clippy rule to avoid wrong usage of tempfile crate

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #2836:
URL: https://github.com/apache/incubator-opendal/pull/2836#discussion_r1289591243


##########
clippy.toml:
##########
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+disallowed-methods = [

Review Comment:
   Thank you for providing the information! I would like to refactor current test logic so that we don't need to create tempfile any more, thus we also don't need to add clippy rules here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-opendal] sarutak closed pull request #2836: feat: Add clippy rule to avoid wrong usage of tempfile crate

Posted by "sarutak (via GitHub)" <gi...@apache.org>.
sarutak closed pull request #2836: feat: Add clippy rule to avoid wrong usage of tempfile crate
URL: https://github.com/apache/incubator-opendal/pull/2836


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-opendal] sarutak commented on a diff in pull request #2836: feat: Add clippy rule to avoid wrong usage of tempfile crate

Posted by "sarutak (via GitHub)" <gi...@apache.org>.
sarutak commented on code in PR #2836:
URL: https://github.com/apache/incubator-opendal/pull/2836#discussion_r1289593671


##########
clippy.toml:
##########
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+disallowed-methods = [

Review Comment:
   O.K. I see.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org